[Question]
  [
Last month I borrowed a plenty of books from the library. They all were good books, packed with emotions and plot-twists. Unfortunately, at some points I got very angry/sad/disappointed, so I tore some pages out.
Now the library wants to know how many pages I have torn out for each book.
Your goal is to write a program, which takes a sorted, comma-delimited list of numbers as input and prints the minimum and maximum possible page count I could have torn out. Each line represents a book, each number represents a missing page from the book.
Example input:
```
7,8,100,101,222,223
2,3,88,89,90,103,177
2,3,6,7,10,11
1
1,2
```
Example output:
```
4/5
5/6
3/6
1/1
1/2
```
`4/5` means, that I may have torn out either 4 or 5 pages, depending on which side the book's page numbering starts. One could have torn out page 6/7, page 8/9, page 100/101, and page 222/223 (4 pages). Alternatively, one could have torn out page 7/8, page 99/100, page 101/102, page 221/222, and page 223/224 (5 pages).
Remember that a book page always has a front and a back side. Also the page numbering differs from book to book. Some books have even page numbers on the left page; some on the right page. All books are read from left to right.
Shortest code in bytes win. Strict I/O format is **not** required. Your programs must be able to take one or more books as input. Have fun.
  
[Answer]
# [05AB1E](https://github.com/Adriandmen/05AB1E), 13 bytes
```
εD>)ÅÈε€θγg}{
```
[Try it online!](https://tio.run/##MzBNTDJM/f//3FYXO83DrYc7zm191LTm3I5zm9Nrq///j44217HQMTQwAGJDHSMjIyA2jtWJNtIx1rGw0LGw1LEESRnrGJqbQ4XNdMyBIjqGhkA@UEtsLAA "05AB1E – Try It Online")
Thanks to [Emigna](https://codegolf.stackexchange.com/users/47066/emigna) for the heads-up on spec changes.
### Explanation
```
εD>)ÅÈε€θγg}{ – Full program.
ε             – For each book...
 D            – Push two copies of it.
  >           – Increment all the elements of the second copy.
   )          – Wrap the whole stack into a list.
    ÅÈ        – Produces the lists of even natural numbers lower or equal to each element.
      ε       – For each (the modified copies of the book):
       €θ     – Get the last item of each.
         γg   – And split into chunks of equal adjacent elements.
           }  – Close the loop.
            { – Sort the resulting list.
```
[Answer]
# [Python 2](https://docs.python.org/2/), ~~72~~ ~~56~~ ~~68~~ 67 bytes
```
lambda b:[map(len,map(set,zip(*[[p/2,-p/2]for p in t])))for t in b]
```
[Try it online!](https://tio.run/##LU1LDoMgEN17CnZK80wFk4Im7UUoC001NVEkyqa9PB1IF2/ebybjP@G9Oxnn@zOuwza@Bjb2Zht8tU4Oic8p4Lv46mKMv0rUNOy8H8yzxbFgOefJheRGG7OezmxNYYyChmgagoCUktBaC0aNRAutoTt0qW4hlLLI8Q2KEgjxXxVEhu7JFrYvmD8WF/IblPWjxFwlzeMP "Python 2 – Try It Online")
[Answer]
# JavaScript, ~~104~~ ~~93~~ ~~92~~ ~~85~~ ~~80~~ ~~79~~ 74 bytes
Would be [57 bytes](https://tio.run/##dZCxasMwEIb3PIUJHSR8EZZManuQtg7t0AwZHYGUWA4OqWxsp41b99ndS1IoLfRAB/r@D06ng3213a6tmn7h68JNpZysVJa92Iacpcoj4Pp68VJ59xasXU/OVzBINYReKU4p66p3R@m0q31XHx071ntigkffnPrgvxqD1alHYePvPszCsNY1zvYk5vRz/EUEko03YT7L8wRS4BG@KeIghMATaw0YCIghTSHNILukMfAk@UnuIUEInN8QR7RElCEBju4SdeDpd6oBDYH9Mkvr2W3/rVQmMOHTevXMur6t/L4qB7KlrLHFgy9IHNFwPgbzv0aJDv7Qoa68wTXo9AU) if not for the unnecessary (in my opinion) requirement that each pair of numbers in the output be consistently sorted, or [47 bytes](https://tio.run/##dZCxboMwEIZ3nsKKOtjiYmGjFBjw1qEdmiEjQbITTESUGgROK1r67PRI1aGVasmW7vs/6e58Nq9mOPZN59eurexc57PJVRGBKPmL6ajLlbNvZGc9NTcw5moMnVKCMT4075bNx9YN7cXyS3uimjy67urJf2ci26tHYe/uPvRa89521ngaC/Y5/SISyd7psAiKBFIQEU4UCZBS4o1LCAoJMaQppBlkSxaDSJIffg8JIhBiAQLBBkGGNQj0NqiCSG9ZCZhLfJceZfC99CFXmujwabd95oPvG3dq6pEeGO9M9eAqGkcsXE1k9deo0cFvObeN0zg8m78A) if we only needed to take one book as input.
Input and output are both an array of arrays.
```
a=>a.map(x=>[0,1].map(n=>new Set(x.map(y=>y+n>>1)).size).sort((x,y)=>x-y))
```
* Initially inspired by [Olivier's Java solution](https://codegolf.stackexchange.com/a/154997/58974) and my own (currently deleted) Japt solution.
* 2 bytes saved thanks to [Arnauld](https://codegolf.stackexchange.com/users/58563/arnauld) (plus another 3 we both spotted at the same time) and 10 bytes *added* thanks to him spotting the broken sorting I'd hoped nobody would notice while that requirement was still under discussion!
---
## Test cases
Test cases are split into individual books for better readability with the last case (which includes the `[1,2]` edge case) serving to illustrate that this solution supports multiple books in the input.
```
f=
a=>a.map(x=>[0,1].map(n=>new Set(x.map(y=>y+n>>1)).size).sort((x,y)=>x-y))
o.innerText=` Input                         | Output\n${`-`.repeat(31)}|${`-`.repeat(21)}\n`+[[[7,8,100,101,222,223]],[[2,3,88,89,90,103,177]],[[2,3,6,7,10,11]],[[1,3,5,7,9,11,13,15,17,18]],[[1],[1,2],[8,10]]].map(b=>` `+JSON.stringify(b).padEnd(30)+"| "+JSON.stringify(f(b))).join`\n`
```
```
<pre id=o></pre>
```
---
## History
```
//104
a=>a.map(x=>x.map(y=>b.add(y/2|0)&c.add(++y/2|0),b=new Set,c=new Set)&&[b.size,c.size].sort((x,y)=>x-y)))
// 93
a=>a.map(x=>[new Set(x.map(y=>y/2|0)).size,new Set(x.map(y=>++y/2|0)).size].sort((x,y)=>x-y)))
// 92
a=>a.map(x=>[(g=z=>new Set(z).size)(x.map(y=>y/2|0)),g(x.map(y=>++y/2|0))].sort((x,y)=>x-y))
// 85
a=>a.map(x=>[(g=h=>new Set(x.map(h)).size)(y=>y/2|0),g(y=>++y/2|0)].sort((x,y)=>x-y))
// 80
a=>a.map(x=>[(g=n=>new Set(x.map(y=>(y+n)/2|0)).size)(0),g(1)].sort((x,y)=>x-y))
// 79
a=>a.map(x=>[(g=n=>new Set(x.map(y=>y/2+n|0)).size)(0),g(.5)].sort((x,y)=>x-y))
// 76
a=>a.map(x=>[0,.5].map(n=>new Set(x.map(y=>y/2+n|0)).size).sort((x,y)=>x-y))
```
[Answer]
# [Retina 0.8.2](https://github.com/m-ender/retina/wiki/The-Language/a950ad7d925ec9316e3e2fb2cf5d49fd15d23e3d), 60 bytes
```
\d+
$*
.+
$&,/$&,
,(?=.*/)
1,
((11)+,)1\1|1+,
1
%O`1+
1+
$.&
```
[Try it online!](https://tio.run/##HYkxCsMwFEN3nSMNdiycyIbYGUqPkAtkSKEdunQoHXt356egJ3jS5/l9ve@tbY@AbkC07jkaoLtd4zB6iHBO8oFem34KhHBZdwVYuti3VlipaTLElJKRkZhZK@vC5TwyVcp/nFnMKR0 "Retina 0.8.2 – Try It Online") Explanation:
```
\d+
$*
```
Convert the page numbers to unary.
```
.+
$&,/$&,
```
Duplicate the list, interposing a `/`.
```
,(?=.*/)
1,
```
Increment the page numbers in one copy of the list.
```
((11)+,)1\1|1+,
1
```
Count the number of pages, but consecutive even and odd numbers only counts as one page.
```
%O`1+
```
Sort the counts into order.
```
1+
$.&
```
Convert the counts back to decimal.
[Answer]
# [Haskell](https://www.haskell.org/), 62 bytes
```
import Data.List
p t=sort[length$nub[div(p+o)2|p<-t]|o<-[0,1]]
```
[Try it online!](https://tio.run/##LcyxCsIwFIXh3afI0EHxVpIUTArt5ugbXDJELDbYJJf26tR3ryk4nOX74Yx@eQ/TtG0hUp5Z3Dz7yz0sfCDB/VIIpyG9eKzS54HP8D3SOZ/0Sl3Nbs1djRKUc1v0IfU0h8RV9CQI0YAFJUuVCrTWZY0D1NCAtWBbaPfUgDLmz1cwRUDtdz8 "Haskell – Try It Online")
[Answer]
# [Java (OpenJDK 9)](http://openjdk.java.net/projects/jdk9/), 163 bytes
```
import java.util.*;
n->{for(int i=n.length;i-->0;){Set s=new HashSet(),t=new HashSet();for(int p:n[i]){s.add(p/2);t.add(++p/2);}n[i]=new int[]{s.size(),t.size()};}}
```
[Try it online!](https://tio.run/##ZU@xboMwFNzzFW@ExriBSIWUEqnq0qVTuiEGF0ziFGyEH6lS5G@nhhC1UYcn37t7Z90d2Yl5quHyWHxuBlE3qkU4WpJ2KCp6Fy/@cWUncxRKjmLTfVQih7xiWsMbExL6BYBGhpZ9UVJ3NW@fhMQ0S7MtlMkgvW1fqtaxHIhE0orLPR5i4XnbVez2O46gE8m/4JXpg90cl@DtHl/tzaNMReb2mrKicJr7wI1xgsvltJhRnrxTAHunxTcfP5yBiY0ZYht4rjHnPilRQG3LODtshdynGbB2r92pG8DcBpBrhGQmAfqQRMRfrez4JAgCO2tDrmJA1iSKSLQhm/FiTfwwvFUfSGgF4vu/9F9IAjNhE09PSVme8wadMYV74XZnjbymqkPa2NxYSee5bdlZ04Lz5l1d2lwck8UszPAD "Java (OpenJDK 9) – Try It Online")
## Explanations
```
n->{                                   // Input-output of int[][]
 for(int i=n.length;i-->0;){           // Iterate on books
  Set s=new HashSet(),t=new HashSet(); // Create two hashsets
  for (int p:n[i]) {                   // Iterate over each page
   s.add(p/2);                         // Add the sheet-of-page of books [ even | odd ] to one set.
   t.add(++p/2);                       // Add the sheet-of-page of books [ odd | even ] to the other set.
  }
  n[i]=new int[] {                     // change the input to the number of sheets used.
   s.size(),
   t.size()
  };
 }
}
```
Note: since there is no requirement about it, the min and max numbers of pages aren't ordered.
[Answer]
# [APL (Dyalog Unicode)](https://www.dyalog.com/), 37 bytes
```
{(≢⍵)≤2:⌽≢∘∪¨⌊⍵(1+⍵)÷2⋄≢∘∪¨⌊⍵(1+⍵)÷2}
```
[Try it online!](https://tio.run/##SyzI0U2pTMzJT///P@1R24RqjUedix71btV81LnEyOpRz14Qt2PGo45Vh1Y86ukCymgYaoPkD283etTdgke2FmjgoRUa5goWCoYGBkBsqGBkZATExpoaRgrGChYWChaWCpYgGWMFQ3NziKiZgjlQQMHQUFMDhBSMNAE "APL (Dyalog Unicode) – Try It Online")
This can be done for less than half the byte count if the output order of pages doesn't matter:
```
{≢∘∪¨⌊⍵(1+⍵)÷2}
```
### How?
```
{(≢⍵)≤2:⌽≢∘∪¨⌊⍵(1+⍵)÷2⋄≢∘∪¨⌊⍵(1+⍵)÷2}⍝ Prefix dfn
{(≢⍵)≤2:                               ⍝ If argument length ≤2 
                    ÷2                 ⍝ Divide by 2
              ⍵(1+⍵)                   ⍝ Both the argument and 1+argument
             ⌊                         ⍝ Round down to the nearest integer
           ∪¨                          ⍝ Get the unique values of each
          ∘                            ⍝ And then
         ≢                             ⍝ Get the tally of elements of each
        ⌽                              ⍝ And reverse the result
                      ⋄                ⍝ Else
                       ≢∘∪¨⌊⍵(1+⍵)÷2} ⍝ Same as above, without reverting the result.
```
[Answer]
# [Perl 5](https://www.perl.org/), 95 + 1 (`-a`) = 96 bytes
```
@0=@1=0;map{$i=-1;$F[$i]+1==$F[$i+1]&&$F[$i]%2==$_&&$i++while++$i<@F&&++@{$_}[0]}0,1;say"@0/@1"
```
[Try it online!](https://tio.run/##JYnBCoJAFEX3fsVDJjcv670RmxEbmJW7vkBEXAgNWEoGEeKvN03G5cI95079Y8i9t2QsGypv3bQIZ1IuRVUL1yAbsy3kJkn@bieDawM5xNfVDT2icGdbJQmiXUS71tSstOdy7t6xpaPl2HsFGpgolEFKGZpFEjLQGnQBxe/IgJXa5AlUYGCOQkB@xunpxvvs00t@ICafdl8 "Perl 5 – Try It Online")
[Answer]
# [Wolfram Language (Mathematica)](https://www.wolfram.com/wolframscript/), 37 bytes
Thanks @MartinEnder for 8 bytes!
```
Sort[Length@*Split/@{#,#+1}~Floor~2]&
```
[Try it online!](https://tio.run/##y00syUjNTSzJTE78n2ar8T84v6gk2ic1L70kw0EruCAns0TfoVpZR1nbsLbOLSc/v6jOKFbtv6Y1V0BRZl6Jg1YaUJqLq9pQx6hWh6vaXMdCx9DAAIiBAkZGQGwMEjbSMdaxsNCxsNSxBMkZ6xiam9dycdX@BwA "Wolfram Language (Mathematica) – Try It Online")
### Explanation
In: `{3, 4, 5}`
```
{#,#+1}
```
Take (input) and (input + 1). `{{3, 4, 5}, {4, 5, 6}}`
```
... ~Floor~2
```
For each number from above, take the largest even number less it. `{{2, 4, 4}, {4, 4, 6}}`
```
Length@*Split/@
```
For each list from above, split the list by same elements `{{{2}, {4, 4}}, {{4, 4}, {6}}}`
and take the length of each: `{2, 2}`
```
Sort[ ... ]
```
Sort the output.
[Answer]
# [Clean](https://clean.cs.ru.nl), ~~222~~ ~~210~~ ~~204~~ 196 bytes
```
import StdEnv,ArgEnv,Data.Maybe,qualified GenLib as G
Start=tl[let(Just l)='G'.parseString i;?s=sum[1\\n<-[s,s+2..last(sort l)]|isAnyMember[n,n+1]l]in zip2(sort[?0,?1])['/\n']\\i<-:getCommandLine]
```
[Try it online!](https://tio.run/##TZDRSsMwFIbvfYrcdWOndenAdroxhpOhbCDsMs3F6ZqVQJLOJBUmPrsxqwpe/Jx8/wkc@I5KoAm6a3oliEZpgtTnznpy8M2TeYe1ba9jgx6zPV5qAW89KnmSoiFbYXayJujI9ubg0fqlV0wJP3rpnSdqvEy2SXZG68TBW2laIh9Wbul6zWhVmUXKHLhJnmUKnR@561E15p/Src1lL3QtLDNgJpQrLg35kOd8@MRWU1hRPmbJbWUSXlVykd63wj92WqNpdtIIHkJgBZRAp9MYCnmex8x4YDnMoCyhnMP8upoBLYrf@g6K2AClkYdAzr@OJ4WtC2kd0uZiUMtjhOdd2PyHH0nDMzoR9q9/VehPndUDRKHR1jc "Clean – Try It Online")
Full-program requirements absolutely murder Clean's ability to compete.
For those who have been paying attention to my answers in Clean, you'll notice `import qualified`, which is an ugly hack to get around using modules that shouldn't be used together, together - which is only needed here because of another ugly hack to do with `GenLib` depending on `Data.Maybe` instead of `StdMaybe`, which is the result of *yet another* ugly hack in the libraries translated from Haskell's `Data` to get functionality before Clean's own libraries are equally complete.
Takes input via command-line arguments.
[Answer]
# [Vyxal](https://github.com/Vyxal/Vyxal), 9 bytes
```
½₍⌈⌊vUvLs
```
[Try it Online!](https://vyxal.pythonanywhere.com/#WyIiLCIiLCLCveKCjeKMiOKMinZVdkxzIiwiIiwiNyw4LDEwMCwxMDEsMjIyLDIyMyJd)
Append a `\/j` for strict I/O compliance (12 bytes)
```
½         # Halve each
 ₍⌈⌊      # Floor and ceiling of each, paired
    vUvL  # Count unique items in each
        s # Sort
```
[Answer]
# Perl, 40 bytes
Inludes `+1` for `a`
```
perl -aE 'say/$/*grep${$.}{$_*$`|1}^=1,@F for-1,1' <<< "7 8 100 101 222 223"
```
Output is not ordered.
Assumes positive page numbers (especially no page `0`). Assumes missing pages are only mentioned once. Doesn't care if the input is ordered or not.
Processing only one book per run saves `3` bytes for `37`:
```
perl -aE 'say/$/*grep$z{$_*$`|1}^=1,@F for-1,1' <<< "7 8 100 101 222 223"
```
]