[Question]
  [
## Description
Given a list of positive integers, write the shortest code to find the number count of the longest consecutive sequence of numbers within the list.
## Input
A list of positive integers. You can assume the list is not empty and may contain duplicates.
## Output
The length of the longest consecutive sequence of numbers within the list.
## Test cases
```
Input: [100, 4, 200, 1, 3, 2]
Output: 4 // because of [1, 2, 3, 4]
Input: [1, 2, 3, 4, 5]
Output: 5 // because of [1, 2, 3, 4, 5]
Input: [10, 9, 8, 7, 6, 5]
Output: 6 // because of [5, 6, 7, 8, 9, 10]
Input: [1, 1, 1, 2, 3]
Output: 3 // because of [1, 2, 3].
Input: [5]
Output: 1 // No consecutive numbers exist. You can leave the Output empty too or output -1. It must be shown by this no consecutive numbers exist
Input: [7, 3, 9, 5, 4, 2, 8]
Output: 4 // because of [2, 3, 4, 5].
```
Code with shortest bytes win, and if equated, the earlier post wins.
  
[Answer]
# [Jelly](https://github.com/DennisMitchell/jelly), 6 bytes
```
f‘$ƬL’
```
[Try it online!](https://tio.run/##y0rNyan8/z/tUcMMlWNrfB41zPx/uP1R05rI//@jow0NDHQUTHQUjEC0oY6CMZAZq8OlEA1kG4G5QElTiAhQhaWOgoWOgrmOghlcFKwNqhosAhE3B2sGqjeFmA/UGBsLAA "Jelly – Try It Online")
```
   Ƭ    -- iterate until the result doesn't change, collecting intermediate value
f‘      -- keep the values that are still in the list when each value is incremented
    L   -- take the length (number of intermediate values, including the initial list and the empty list at the end)
     ‘  -- decrement
```
[Answer]
# [Jelly](https://github.com/DennisMitchell/jelly), 5 [bytes](https://github.com/DennisMitchell/jelly/wiki/Code-page)
```
ṬŒg§Ṁ
```
A monadic Link that accepts a list of positive integers and yields the length of the longest consecutive sequence.
**[Try it online!](https://tio.run/##y0rNyan8///hzjVHJ6UfWv5wZ8P/o5Me7pyhc7g961HDHAVbO4VHDXM1I///j442NDDQUTDRUTAC0YY6CsZAZqwOl0I0kG0E5gIlTSEiQBWWOgoWOgrmOgpmcFGwNqhqsAhE3BysGajeFGI@UCNY3BgsYg6WMjSEKYWYaAaWM42NBQA "Jelly – Try It Online")**
### How?
```
ṬŒg§Ṁ - Link: list of positive integers, A  e.g. [4, 8, 3, 4, 2, 7, 4]
Ṭ     - untruth {A}                              [0, 1, 1, 1, 0, 0, 1, 1]
                                         ( i.e.:     2  3  4        7  8  )
 Œg   - group runs of equal elements             [[0], [1, 1, 1], [0, 0], [1, 1]]
   §  - sums                                     [0, 3, 0, 2]
    Ṁ - maximum                                  3
```
[Answer]
# [Haskell](https://www.haskell.org/), 32 bytes
```
f[]=0
f l=1+f[n|n<-l,elem(n+1)l]
```
[Try it online!](https://tio.run/##XU7NDsIgDL7vKXrcsmoAndNEHsEnIBw4QFwEsgyOvjsWtpNJk/b7Td8mfaz3pTilJesceMlHp@I3Pk8erbehjyMfvC7ZppykUpwxhCuCqJsjXOjUqOgSDZA0VUzqA@GOMCPcDq4FDifhys0tRM5pb6XIX5vYR@sumCWChGDWF/TrtsR8dgO0x8oP "Haskell – Try It Online")
Repeatedly filters `l` by only keeping elements `n` where `n+1` is also in `l`, and counts how many repetitions until the list is empty.
[Answer]
# [Python 3](https://docs.python.org/3/), 45 bytes
```
f=lambda l:len(l)and-~f({*l}&{x-1for x in l})
```
[Try it online!](https://tio.run/##XY7RCsIgFIbve4pzFRpnMOfcVtCTRBfGkgbmxtjFYqxXtzMtVqHowe87v6d7DLfWSe/N0er7pdZgD/bqmOXa1cnTsGln5@00JsK0PYzQOLAz913fuIHlCIadRJoiUJktt0CQVJ4530RHRYfeAiFPrbB4ByDsESqEEqH4EeSnO@4lY4UiwC87zlOGjyhQxbEo@V8RmKHEnE5aBP0L "Python 3 – Try It Online")
Without using sets:
**[Python](https://docs.python.org/3/), 48 bytes**
```
f=lambda l:l>[]and-~f([x for x in l if-~x in l])
```
[Try it online!](https://tio.run/##XY7NCoMwEITvfYo5GljBGH/aQvsikkOKhAppFPFgL756upoW25IlGXa@nezwnO69VyHYizOPW2vgzu7aaOPbdLFJM8P2I2Z0Hg6dTZcotQjD2PkpKQhMySwjsMzXVxIUSy3EITJlZLi3OcyVu1m9AwgnwpFQE6ofQH2mY60Zuyk384uO@9TbRxxYxrU4@R@RlJOigm8@bIYX "Python 3 – Try It Online")
Repeatedly filters `l` by only keeping elements `x` where `x+1` is also in `l`, and counts how many repetitions until the list is empty.
[Answer]
# [Vyxal](https://github.com/Vyxal/Vyxal), 35 [bitsv2](https://github.com/Vyxal/Vyncode/blob/main/README.md), 4.375 bytes
```
ÞǔĠṠG
```
**[Try it Online!](https://vyxal.pythonanywhere.com/?v=2#WyI9QSIsIiIsIsOex5TEoOG5oEciLCIiLCJbMTAwLCA0LCAyMDAsIDEsIDMsIDJdXG5bMSwgMiwgMywgNCwgNV1cblsxMCwgOSwgOCwgNywgNiwgNV1cblsxLCAxLCAxLCAyLCAzXVxuWzVdXG5bNywgMywgOSwgNSwgNCwgMiwgOF1cblszLCA1LCA3LCA5LCAxMV1cbls3LCA3LCA2LCA2LCA1LCA1XSJd)**
### How?
Port of my Jelly answer.
```
ÞǔĠṠG - list of positive integers     e.g. [4, 8, 3, 4, 2, 7, 4]
Þǔ    - unthruth                           [0, 1, 1, 1, 0, 0, 1, 1]
                                   ( i.e.:     2  3  4        7  8  )
  Ġ   - group runs of equal elements       [[0], [1, 1, 1], [0, 0], [1, 1]]
   Ṡ  - sums                               [0, 3, 0, 2]
    G - maximum                            3
```
[Answer]
# [J](https://www.jsoftware.com), 22 bytes
```
[:#[:+/ .*~^:a:~1=-//~
```
[Attempt This Online!](https://ato.pxeger.com/run?1=m70wa8FNVUtFK8NYM0UrS3V1LiU99TQFWysFdQUdBQMFKyDW1VNwDvJxW1pakqZrsS3aSjnaSltfQU-rLs4q0arO0FZXX78OInmzS5MrNTkjXyFNwdDAQEfBREfBCEQb6igYA5kwOXMw11JHwRSiREfBAq4NzDUGi5sizAKrttAB6TRDkjDFYyLERQsWQGgA)
We view this is a graph problem. Let's consider the example `10, 9, 8, 7, 6, 5` for the explanation:
* `1=-//~` Create an adjacency matrix, where two numbers are connected if their difference is 1 (signs matter):
```
0 1 0 0 0 0
0 0 1 0 0 0
0 0 0 1 0 0
0 0 0 0 1 0
0 0 0 0 0 1
0 0 0 0 0 0
```
This says that 10 connects to 9, 9 connects to 8, etc.
* `[:+/ .*~^:a:` Multiply this matrix by itself until we reach a fixed point. One self-multiplication, eg, tells us the connections after two steps:
```
0 0 1 0 0 0
0 0 0 1 0 0
0 0 0 0 1 0
0 0 0 0 0 1
0 0 0 0 0 0
0 0 0 0 0 0
```
After two steps, 10 connects to 8, 9 to 7, etc. Then two self multiplications show us the connections after 3 steps, and so on. Eventually, we'll reach a matrix of all zeroes and stop, and the length of this chain tells us the length of the longest consecutive run of numbers.
* `[:#` So we return that length.
## [J](https://www.jsoftware.com), port of ovs's answer, ~~21~~ 20 bytes
```
1#@}.((e.>:)#[)^:a:~
```
[Attempt This Online!](https://ato.pxeger.com/run?1=m70wa8FNVUtFK8NYM0UrS3V1LiU99TQFWysFdQUdBQMFKyDW1VNwDvJxW1pakqZrscVQ2aFWT0MjVc_OSlM5WjPOKtGqDiJ1s0uTKzU5I18hTcHQwEBHwURHwQhEG-ooGAOZMDlzMNdSR8EUokRHwQKuDcw1BoubIswCq7bQAek0Q5IwxWMixEULFkBoAA)
[Answer]
# [R](https://www.r-project.org), ~~50~~ ~~38~~ 37 bytes
*Edit: -1 bytes thanks to Giuseppe*
```
\(x,y=rle(1:max(x)%in%x))max(y$l*y$v)
```
[Attempt This Online!](https://ato.pxeger.com/run?1=m72waMGiNNulpSVpuhY3VWM0KnQqbYtyUjUMrXITKzQqNFUz81QrNDVBnEqVHK1KlTJNqOLtaRrJGoYGBjoKJjoKRiDaUEfBGMjU1FRQVjDhAksDuWBBoBJTsLgpRByo2lJHwUJHwVxHwQwmZwbTA0EgnWBxY7A4RI2BQn6RgiFYwBxsMtAYU4gTgObhsNoIgiCyEOcvWAChAQ)
[Answer]
# [Scala 3](https://www.scala-lang.org/), ~~74~~ ~~73~~ 70 bytes
Port of [@xnor's Python answer](https://codegolf.stackexchange.com/a/265097/110802) in Scala.
Thanks to [@corvus\_192](https://codegolf.stackexchange.com/users/46901/corvus-192)'s comment and [@Kjetil S](https://codegolf.stackexchange.com/users/64733/kjetil-s)'s comment.
---
```
def f(l:Seq[Int]):Int=if(l.size<1)0 else 1+f(l.filter(l contains _+1))
```
[Attempt This Online!](https://ato.pxeger.com/run?1=hVHLSsNAFMVtvuJQXMzQUTJN0tZgF24EQVfFVRGJcVJGxqlmxoWWrP0IN3Wh_2S_xpsEwZSIzHDvncM59zVvny7PTBZttnuvq5s7lXtcZNpiHQC3qsA9PVhWLl2Kk7LMnhdzX2q7vOIpLq32mDVM4IFQbyxzg5iw_XXBzrXzTIahQCwwqr0UiCjkvBrwHVHSERGpoZIw6WOPuyUEjgSmAhOB8R-KaCd_e-sqfWz5m92brzPkpGmWekjaWamZfzVSjEQkYrJ0fthVQCb4ePLFwfTrtF5_wUw6V4-LM-tp5WRnmqBDp1_UseQhlHEKclhjhTZelcwgX1lPv-ZwPZSct9neq9ZvNq3_Bg)
[Answer]
# [Vyxal](https://github.com/Vyxal/Vyxal) `G`, 56 [bitsv2](https://github.com/Vyxal/Vyncode/blob/main/README.md), 7 bytes
```
ṗ's¯1=A;@
```
[Try it Online!](https://vyxal.pythonanywhere.com/?v=2#WyJHPSIsIiIsIuG5lydzwq8xPUE7QCIsIiIsIjEwMCwgNCwgMjAwLCAxLCAzLCAyIl0=)
#### Explanation
```
ṗ's¯1=A;@  '# Implicit input
ṗ'     ;   '# Filter the powerset by:
  s¯        #  Sort and get deltas
    1=A     #  All equal to 1?
        @   # Length of each inner list
            # Take the maximum
            # Implicit output
```
[Answer]
# [julia](https://julialang.org/), ~~24~~ 22 bytes
*Edit: 2-byte improvement due to [MarcMush](https://codegolf.stackexchange.com/users/98541/marcmush)*
Same approach as most others here, counting how many times `v` can be intersected with `v-1` before we get an empty list
```
!v=v>[]&&!(v∩.~-v)+1
```
[Attempt This Online!](https://ato.pxeger.com/run?1=m700qzQnM3HBgqWlJWm6FtsUy2zL7KJj1dQUNcoedazUq9Mt09Q2hEjePKcYbWhgoKNgoqNgBKINdRSMgcxYhRo7hYKizLySnDwuoBKgEFgCqMwUXQ6oy1JHwUJHwVxHwQyLPNhQqAlocuhqzcGWAE0zhbgIaCwelxhBELIKiK9gXgcA)
### How?
```
!v =
  v > [] &&         # return 0 if v == [] and terminate, otherwise proceed
  !(v ∩ .~ -v) + 1  # recurse on the intersection of v with v + 1 and add 1 
                      to count recursion depth. Here, ~ is bitwise not, so
                      ~(-k) == k-1 for signed integers.
```
[Answer]
# [Factor](https://factorcode.org) + `math.extras`, 51 bytes
```
[ sort members [ - -1 = ] max-monotonic-count 1 + ]
```
[Attempt This Online!](https://ato.pxeger.com/run?1=XY-9bsIwFIX3PMXZkVGctA0UMVddulRMiCFEFxqB7dS-kUCIJ-mShb4TL9K5N4kiEL6SffzdP52f301esPPN9W_x-f7x9orgPJd2i0AcYHL-wo68pX2nx3RgnwdJftdkCwqoPDEfK19axiyKThHknKDjGE9I5NZIkeA8cNGpZJ5vJMYUE2R4uYddtKUDueUyoVP5y3jpexycdDHQVOoyqdb6rr1d1S5rR54vNW_U5JouO-MwZNbkA5ZQUBpzrMT3QRlnHTtbFqpwtTjVGGHVt15MXmHc66bp338)
Sort, uniquify, then count the longest run of two adjacent numbers differing by one.
[Answer]
# [Python](https://www.python.org), ~~122~~ ~~113~~ ~~101~~ ~~52~~ 51 bytes
Port of Arnaulds answer
```
lambda a:max(map(g:=lambda v:v in a and-~g(v+1),a))
```
[Attempt This Online!](https://ato.pxeger.com/run?1=XY9NDoIwEIX3nmKWbRgTyr8knERZ1BCQRAox2OhZ3JAYvY5rb-NAS1DTpjOZ982b6e3ZXftDq4Z7me0e575cJ-_gKJt9IUGmjbywRnasSjNb06mGWgGJqgDhVEw7gqPk3Pa-ulOtehYglGwrXBeBUm-MAsGnNOd8ZZjQMFSbFOLCRYysAcIGIUGIEaIfwJ-7zR09FlFM4hdt9omnQWQYmrXI-R8R6KGPAb108vlbw2DiBw)
Previous Answer
```
lambda a:max(len([*l])for b,l in groupby(r in a for r in range(max(a)+1))if b)
from itertools import*
```
[Attempt This Online!](https://ato.pxeger.com/run?1=XY9LDgIhDIb3nqJL0JqI4_hKPIm6YOKgJAxMEBM9i5tJjF7HtbexDBofgdDC9_dvOd_qU9g521zUYnU9BNWfPkojq2IjQc4reWSmtGzZNWuunIcCDWgLW-8OdXFiPl4kRNKmXtptyWKV5D3BuVZQ8I7yrgIdSh-cM3vQVe186L6a3WuvbWAjBMWWYjBAoHQYo0DIKF1z3kmaPGnorSWkyz9w_DJAmCFMESYI4x9B9q5OO3p8oGjhlzrNM2kbkWGexiLnf4nAIWY4opMWwfStpknxCQ)
[Answer]
# [Nekomata](https://github.com/AlephAlpha/Nekomata), 7 bytes
```
ˡ{N→ᵈ:∩
```
[Attempt This Online!](https://ato.pxeger.com/run?1=m70iLzU7PzexJHFZtJJurlLsgqWlJWm6FutOL6z2e9Q26eHWDqtHHSuXFCclF0OlFtz0iTY0MNAx0TECkoY6xjpGsVzRhjpGQJaJjimIbaBjqWOhY65jBuHqgCBQGsgG8c2BCi11TEEG6FjEQgwFAA)
A port of [@ovs's Jelly answer](https://codegolf.stackexchange.com/a/265096/9288).
```
ˡ{N→ᵈ:∩
ˡ{          Loop until failure, and return the number of iterations
  N             Check if the list is nonempty
   →            Increment
    ᵈ:∩         Intersect with the input
```
[Answer]
# [05AB1E](https://github.com/Adriandmen/05AB1E/wiki/Commands), 6 [bytes](https://github.com/Adriandmen/05AB1E/wiki/Codepage)
```
ZLåγOà
```
Port of [*@JonathanAllan*'s Jelly answer](https://codegolf.stackexchange.com/a/265099/52210), so make sure to upvote him as well!
[Try it online](https://tio.run/##yy9OTMpM/f8/yufw0nOb/Q8v@P8/2tDAQMdEx8hUx0zHWMc0FgA) or [verify all test cases](https://tio.run/##yy9OTMpM/V9Waa@k8KhtkoKSfeX/KJ/DS89t9j@84L/O/@hoQwMDHRMdIyBpqGOsYxSrE22oYwRkmeiYgtgGOpY6FjrmOmYQrg4IAqWBbBDfHKjQUscUZICOBVg52DBToHJjoIZYAA).
**Explanation:**
```
Z       # Push the maximum of the (implicit) input-list (without popping)
 L      # Pop and push a list in the range [1,max]
  å     # Check for each value whether it's in the input-list (1 if truthy; 0 if falsey)
   γ    # Group adjacent equal bits together
    O   # Sum each inner list
     à  # Pop and push the maximum
        # (which is output implicitly as result)
```
---
Since I was curious: a port of [*@ovs*' Jelly answer](https://codegolf.stackexchange.com/a/265096/52210) is 8 [bytes](https://github.com/Adriandmen/05AB1E/wiki/Codepage) instead:
```
.ΓÐ<åÏ}g
```
[Try it online](https://tio.run/##yy9OTMpM/f9f79zkwxNsDi893F@b/v9/tKGBgY6JjpGpjpmOsY5pLAA) or [verify all test cases](https://tio.run/##yy9OTMpM/V9Waa@k8KhtkoKSfeV/vXOTD0@wObz0cH9t@n@d/9HRhgYGOiY6RkDSUMdYxyhWJ9pQxwjIMtExBbENdCx1LHTMdcwgXB0QBEoD2SC@OVChpY4pyAAdC7BysGGmQOXGQA2xAA).
**Explanation:**
```
.Γ    }   # Continue until the list no longer changes, keeping all intermediate results
          # (excluding the initial value), using the (implicit) input-list
  Ð       #  Triplicate the current list
   <      #  Pop the top copy, and decrease all its values by 1
    å     #  Pop it and another list, and check for each value-1 whether it's in thelist
     Ï    #  Pop both again, and keep all values at the truthy positions
       g  # After the changes-loop: pop and push its length
          # (which is output implicitly as result)
```
[Answer]
# [Nibbles](http://golfscript.com/nibbles/index.html), ~~5.5~~ 5 bytes (10 nibbles)
```
,|`.$`&+~$
```
[Attempt This Online!](https://ato.pxeger.com/run?1=m708LzMpKSe1eMGCpaUlaboWq3RqEvRUEtS061QgAlDxndFK0eY6CsY6CpY6CqY6CiY6CkY6ChaxSrFQBQA)
Port of [ovs' Jelly answer](https://codegolf.stackexchange.com/a/265096/95126).
```
,|`.$`&+~$    # full program
,|`.$`&+~$$   # with implicit arg:
  `.          # iterate while unique
    $         # starting with input:
       +~$    #   add 1 to every element
     `&       #   intersection with original list
 |            # now, filter this list-of-lists
          $   #   to include only non-empty lists
,             # and return its length
```
[Answer]
# JavaScript (ES6), 51 bytes
```
a=>Math.max(...a.map(g=v=>a.includes(v)&&1+g(v+1)))
```
[Try it online!](https://tio.run/##jc9LDoIwEAbgvaeYFWlDLRQEdFFu4AkMi4aXGKREsPH2tVBDFF3YTNJJ@uXvzEUoMeS3ph@3nSxKXXEteHoU45lexQNRSoVpelRzxVNBmy5v70U5IIUdh7k1Ui7DGOtcdoNsS9rKGlXoxHyfwI5AMN2MQGjaDGPwPNht1ta8zcL4KAN7rI2@rIk7ENgTSAjEL29t/CPX1pT@mRuu7fLv@7GWrW0yD2umiOyKZpwM/tgtsLVY/QQ "JavaScript (Node.js) – Try It Online")
### Commented
```
a =>                 // a[] = input array
Math.max(...         // return the maximum value in this:
  a.map(g = v =>     //   for each value v in a[],
                     //   using a recursive callback function g:
    a.includes(v) && //     if a[] includes v:
      1 +            //       increment the final result
      g(v + 1)       //       and do a recursive call with v + 1
  )                  //   end of map()
)                    // end of Math.max()
```
---
# JavaScript (ES6), 56 bytes
*This version was originally shorter (50 bytes), but invalid (as pointed out by [Dominic van Essen](https://codegolf.stackexchange.com/users/95126/dominic-van-essen)). Now fixed at the cost of 6 bytes by adding `p^v?...:0`, which makes it uncompetitive.*
Expects an `Uint32Array`.
```
a=>a.sort().map(p=v=>p^v?p+1^(p=v)?i=1:m+=++i>m:0,m=1)|m
```
[Try it online!](https://tio.run/##nZDbCsIwDIbvfYpctqzOdUcVOvEhvJINytxkYteyjYngu9fugIo3E0MgCeTLn@TCO95kdanaZSVPuS6Y5izmdiPrFmFbcIUU61is0m6nLJr2Fd6VjG6FxSyrjMXWIYJR/BA6k1Ujr7l9lWdUoCq/waGsWs/d1zW/oyN1HAI@AbePlIBn0gRjDKsV@Is52DQPiBkQJDDaBAezsBHcEFgTiAiE04AJDn9QHr3X/1L25uDXqp82wXQOjoaDzeLB@DdzQQL/PMwd/Q3rJw "JavaScript (Node.js) – Try It Online")
[Answer]
# [Ruby](https://www.ruby-lang.org/), ~~48~~ 47 bytes
```
->l{1.step.find{|z|l.all?{|x|[*x..x+z]-l!=[]}}}
```
[Try it online!](https://tio.run/##KypNqvyfZvtf1y6n2lCvuCS1QC8tMy@luqaqJkcvMSfHvrqmoiZaq0JPr0K7KlY3R9E2Ora2tvZ/gUJadLShgYGOgomOghGINtRRMAYyY2O5wHImOuY6lrGx/wE "Ruby – Try It Online")
[Answer]
# [Charcoal](https://github.com/somebody1234/Charcoal), ~~23~~ ~~19~~ 13 bytes
```
ＩＬ⌈⪪⭆⊕⌈θ¬№θι1
```
[Try it online!](https://tio.run/##S85ILErOT8z5/z@gKDOvRMM5sbhEwyc1L70kQ8M3sSIztzRXI7ggJ7NEI7gEqCDdN7FAwzMvuSg1NzWvJDUFrqZQU1NHwS8faEB@KdCYQh2FTE2QkJKhkiYIWP//Hx1tqKMAQUY6Csaxsf91y3IA "Charcoal – Try It Online") Link is to verbose version of code. Explanation: Port of @JonathanAllan's Jelly answer, with the "untruth" replaced by a map over range using `0` for present and `1` for absent as this lets me split on `1`s to find the longest run of `0`s. (I can't split on `0`s as this will fail if there are `10` of the same value in the list.)
```
       θ        Input list
      ⌈         Maximum
     ⊕          Incremented
    ⭆           Map over implicit range and join
         №      Count of
           ι    Current value
          θ     In input list
        ¬       Logical Not
   ⪪        1   Split on `1`s
  ⌈             Take the longest run of `0`s
 Ｌ              Take the length
Ｉ               Cast to string
                Implicitly print
```
Previous 19-byte solution also works with negative integers:
```
Ｉ⌈Ｅθ⌈Ｅθ∧¬⁻…·ιλθ⊕⁻λι
```
[Try it online!](https://tio.run/##S85ILErOT8z5/z@gKDOvRMM5sbhEwzexIjO3NBdIF2gU6iigcR3zUjT88oGqMvNKizU885JzSoszy1KDEvPSUzUydRRyNHUUCjWBBFCqKDU3Na8kNQWqOEdHIVMTAqz//4@ONtRRgCAjHQXj2Nj/umU5AA "Charcoal – Try It Online") Link is to verbose version of code. Explanation: Creates inclusive ranges between all pairs of input elements and outputs the length of the longest range that is a subset of the input.
```
   θ                Input array
  Ｅ                 Map over elements
      θ             Input array
     Ｅ              Map over elements
          …·        Inclusive range from
            ι       Outer value to
             λ      Inner value
         ⁻          Remove elements found in
              θ     Input array
        ¬           Is empty
       ∧            Logical And
                 λ  Inner value
                ⁻   Minus
                  ι Outer value
               ⊕    Incremented
    ⌈               Take the maximum
 ⌈                  Take the maximum
Ｉ                   Cast to string
                    Implicitly print
```
[Answer]
# [Perl 5](https://www.perl.org/), 32 bytes
```
sub f{@_?1+f(grep$_+1~~@_,@_):0}
```
[Try it online!](https://tio.run/##hVFNb4JAFDyXXzGhGDGuFqpoq6FybZropZfGEiJ0UVJhCbu0GqN/3S7g16G1ZAPsvJl583ZTmi2t/Z7nPsKN443MZqjPM5pqXtPc7RyPOF5jYGz3Ict0BZhiahoGQZfgvviaBB3568J@QhdwCXCLuzv4NJjlnIKFUiAJJa3rHhxOAIFVSq1/pQXz2J/gkeCBoE/QOzr0/nCwSk6/5EuVaZwzVKvwLx061zO47UpYtTMvyGOGgCWcBrmIviiSPPZpxkFXERdtvLEcwSzBks5kUSwoJrlIcwEap2INwRhYBlZhLbONZ4E450JmAF@w7wS@ZC0ijuRKnypbvzwrOaZV3ZCc@nQzv0x2cbRtpbGRHkC81rUokVkINLpKaSDoRwM2HM0bHgjanAk71J2K16jgNIsSEaq1Vo8DZWGAWsssdjj6DM6WEpUuEpDv90Qlys2pZNsFiBHq7LOOAerjySsmL3VS9ike9dBaHSrb/Q8 "Perl 5 – Try It Online")
Copied idea from others here. Return count of rounds of removal of ints n where n+1 dont exists before list is empty.
[Answer]
# Rust, 74 bytes
[Try it online!](https://tio.run/##dY/dDoIgFIDvfYrTjYPGmGb@lOtJnHOs4XIpFeJ0y57dDlp3yhgcOB/f4eiuNVOpoBGVIvQNOBy71NJACReYRnF2sy7JR7IXvDJSE8oby/JO9Vo8MeCUG3GXRX@raknGYRT8@lAGjS0ZKMVDpwyhU@rMatG2UptCvnakJG7mex6DI4OD3X0GAYY5xSuaruKYniF8Elou3ODQdmKQMIgZRD822nQu05otF6xzs8Nfz8Xzp7BiuHSDpf9dfKYv)
```
|a:&[u8]|(*a.iter().min().unwrap()..).take_while(|x|a.contains(x)).count()
```
Explanation:
```
let f = |a: &[u8]| {
    // create an iterator starting from the least element
    (*a.iter().min().unwrap()..)
        // take item if in list, stopping at the first item not in list
        .take_while(|x| a.contains(x))
        // get total number of items taken
        .count()
};
```
[Answer]
# [**T-SQL**](https://learn.microsoft.com/en-us/sql/t-sql/language-reference?view=sql-server-ver16), 114 bytes
`SELECT MAX(c)FROM(SELECT COUNT(b)c FROM(SELECT a*(a+1)/2-SUM(a)OVER(ORDER BY a)b FROM @t GROUP BY a)X GROUP BY b)Y`
[dbfiddle](https://dbfiddle.uk/uXXcla-Q)
Readable version of the code:
```
DECLARE @t TABLE(i INT NOT NULL IDENTITY(1,1) --table with identity to emulate a 'list' (not counted in byte count)
                , a INT NOT NULL);
INSERT INTO @t (a) --Assigning the 'list' values (not counted in byte count)
VALUES(100)
    , (4)
    , (200)
    , (1)
    , (3)
    , (2);
SELECT MAX(c) --5. Determine the maximum count from the subquery
FROM(
    SELECT COUNT(*)c --4. Count how many rows make up each group
    FROM(
        --After this query it is simply a matter of determining which value of b appears the most times, and how many times that is.
        SELECT a*(a+1)/2-SUM(a) OVER(ORDER BY a)b /*2. Calculates the sum of values which are missing from the consecutive sequence 
                                                between 1 and a (both inclusive). 
                                                This utilises the default behaviour of the windowed function. This defaults to:
                                                SUM(a) OVER(ORDER BY a ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW)
                                                Which is far more descriptive, but too verbose for golf :).*/
        FROM @t
        GROUP BY a --1. Removes duplicate occurences of a, as this is just noise anyway...
    )X --necessary alias
    GROUP BY b -- 3. Group by b as these are the groups we want to know the size of
)Y --necessary alias
```
This algorithm does the following:
* Remove duplicate elements (essentially turn a list into a set)
* Order the elements
* Find all the consecutive sequences
* Prescribe a unique identifier for each consecutive sequence
* Get the count of elements in each distinct sequence (length of each sequence)
* Get the maximum count.
In my opinion the interesting part of this is prescribing the unique identifier.
Let's generalise the problem, starting with an arbitrary subset of the natural numbers.
$$X \subseteq \mathbb N\_{\ne 0}$$
Consider the following binary relation
$$R = \{(a, b): |a - b| \leq 1, (a, b) \in X \times X\}$$
`R` is the set of all ordered pairs which are no more than 1 distance apart.
Here the distance is taxicab or L1 or whatever you want to call it.
It's fairly easy to see that `R` is symmetric, and reflexive, but NOT transitive.
Take the example
$$X = \{1, 2, 3, 5, 6, 7, 8\}$$
$$(1, 2) \in R , (2, 3) \in R , (1, 3) \notin R$$
You can't have three distinct natural numbers all within a distance of 1 from eachother.
We need to extend the definition of `R` so that it is transitive. We need to find
the transitive closure of `R`.
$$R^{+} = R \cup \{(a, c): (a, b) \in R \wedge (b, c) \in R\}$$
Now we have an equivalence relation, and it properly describes the equivalence classes that underly this problem. However we still need to determine a label for each of these equivalence classes. Normally the smallest positive representitve of each equivalence class is chosen. This would be `[1]` and `[5]` in the example above. But these are just labels, as long as they are unique they could be anything. Let's make a function that sufficiently labels an element's equivalence class.
$$Label(i) = \sum\_{k=1}^{i} k - \sum\_{j\in X \wedge j\leq i}{j}$$
We can replace the first sum with the equivalent expression
$$ \sum\_{k=1}^{i} k = \frac{i(i + 1)}{2}$$
Thus,
$$Label(i) = \frac{i(i + 1)}{2} - \sum\_{j\in X \wedge j\leq i}{j}$$
Intuitively this is just the sum of everything 'missing' up to the current element.
$$Label(i) = \sum\_{j \in \mathbb N\_{\ne 0} \setminus X \wedge j \leq i} j$$
Now i am really interested, is there a generalisation of this? That is to say if we take the base relation `R` and redefined it:
$$R = \{(a, b): |a - b| \leq k, (a, b) \in X \times X\}, k \in \mathbb N\_{\ne 0}$$
Would there be an equivalent intuitive 'label function' for any value of `k`?
[Answer]
# [Retina 0.8.2](https://github.com/m-ender/retina/wiki/The-Language/a950ad7d925ec9316e3e2fb2cf5d49fd15d23e3d), 51 bytes
```
$
, 
\d+
$*
D`1+, 
O`1+
(\G1+, |1\1)+
$#1¶
O#^`
1G`
```
[Try it online!](https://tio.run/##K0otycxL/K@q4Z7wX4VLR4ErJkWbS0WLyyXBUBvI8wdSXBox7iBOjWGMoSZQUtnw0DYuf@W4BC5DoKb/hgYGOgomOgpGINpQR8EYyOQC0kZgJlDClMsQKGOpo2Cho2Cuo2AGFgErhariMuUyBysGqjGFmAVUDAA "Retina 0.8.2 – Try It Online") Link includes test cases. Explanation:
```
$
, 
```
Suffix a comma to the last entry too.
```
\d+
$*
```
Convert to unary.
```
D`1+, 
```
Deduplicate.
```
O`1+
```
Sort ascending.
```
(\G1+, |1\1)+
$#1¶
```
Count consecutive sequences. The first alternation is only possible at the start of the match, while the second alternation is only possible on subsequent repetitions of the capture group.
```
O#^`
```
Sort descending numerically.
```
1G`
```
Take the first (i.e. largest).
[Answer]
# Excel, 65 bytes
```
=MAX(LEN(TEXTSPLIT(CONCAT(FREQUENCY(A1#,SEQUENCE(MAX(A1#)))),0)))
```
Input is spilled *vertical* array in `A1#`.
[Answer]
# C (clang 16), 93 bytes
Using C23 `_BitInt(65536)` as a clang extension in C89 for implicit `int`. Works for input integers in the range [0,65535], e.g. 16-bit unsigned (but it takes them as an array of `int`, with an `int n` length). It returns the count.
```
typedef _BitInt(1<<16)T;f(*p,n){T b=0;for(;n--;)b|=(T)1<<p[n];for(n=1;b&=b<<1;n++);return n;}
```
First loop: Add each input to a set implemented as a bitmap (`bitset |= 1<<n`). Second loop: treating that as a wide integer, count the longest run of set bit. (Shift and AND to remove the low bit from each run of bits, count iterations until the whole thing becomes zero.)
[Godbolt](https://godbolt.org/#g:!((g:!((g:!((h:codeEditor,i:(filename:%271%27,fontScale:14,fontUsePx:%270%27,j:1,lang:___c,selection:(endColumn:1,endLineNumber:14,positionColumn:1,positionLineNumber:2,selectionStartColumn:1,selectionStartLineNumber:14,startColumn:1,startLineNumber:2),source:%27%23if+0%0Atypedef+_BitInt(1%3C%3C8)T%3Bungolfed(*p,n)%7B%0A++++T+bitset+%3D+0%3B%0A++++for(%3Bn--%3B)%7B%0A++++++++bitset+%7C%3D+(T)1%3C%3Cp%5Bn%5D%3B%0A++++%7D%0A++++int+retval%3D1%3B%0A++++//+https://stackoverflow.com/questions/3304705/finding-consecutive-bit-string-of-1-or-0%0A++++while(bitset+%26%3D+bitset%3C%3C1)%7B+//+doesn!%27t+count+the+iteration+that+clears+the+last+bit,+hence+retval%3D1+to+start%0A++++++++retval%2B%2B%3B%0A++++%7D%0A++++return+retval%3B%0A%7D%0A%23endif%0Atypedef+_BitInt(1%3C%3C16)T%3Bf(*p,n)%7BT+b%3D0%3Bfor(%3Bn--%3B)b%7C%3D(T)1%3C%3Cp%5Bn%5D%3Bfor(n%3D1%3Bb%26%3Db%3C%3C1%3Bn%2B%2B)%3Breturn+n%3B%7D%0A%0A%23include+%3Cstdio.h%3E%0Aint+main()%7B%0A++++int+arr%5B%5D+%3D+%7B%0A++++//++++7,+3,+9,+5,+4,+2,+8%0A++++//+1,+1,+1,+2,+3%0A++++//10,+9,+8,+7,+6,+5%0A++++//+5%0A++++100,+4,+200000,+1,+3,+2%0A++++%7D%3B%0A++++%0A++++int+n+%3D+sizeof(arr)/sizeof(arr%5B0%5D)%3B%0A++++printf(%22%25d%5Cn%22,+f(arr,n))%3B%0A%7D%27),l:%275%27,n:%270%27,o:%27C+source+%231%27,t:%270%27)),k:50,l:%274%27,m:100,n:%270%27,o:%27%27,s:0,t:%270%27),(g:!((g:!((h:compiler,i:(compiler:cclang1600,deviceViewOpen:%271%27,filters:(b:%270%27,binary:%271%27,binaryObject:%271%27,commentOnly:%270%27,debugCalls:%271%27,demangle:%270%27,directives:%270%27,execute:%270%27,intel:%270%27,libraryCode:%270%27,trim:%271%27),flagsViewOpen:%271%27,fontScale:14,fontUsePx:%270%27,j:1,lang:___c,libs:!(),options:%27-std%3Dgnu89+-Os+-Wall+-Wno-implicit-int%27,overrides:!(),selection:(endColumn:1,endLineNumber:1,positionColumn:1,positionLineNumber:1,selectionStartColumn:1,selectionStartLineNumber:1,startColumn:1,startLineNumber:1),source:1),l:%275%27,n:%270%27,o:%27+x86-64+clang+16.0.0+(Editor+%231)%27,t:%270%27)),header:(),k:100,l:%274%27,m:60.39213615643205,n:%270%27,o:%27%27,s:0,t:%270%27),(g:!((h:output,i:(compilerName:%27x86-64+gcc+13.2%27,editorid:1,fontScale:14,fontUsePx:%270%27,j:1,wrap:%271%27),l:%275%27,n:%270%27,o:%27Output+of+x86-64+clang+16.0.0+(Compiler+%231)%27,t:%270%27)),l:%274%27,m:39.60786384356794,n:%270%27,o:%27%27,s:0,t:%270%27)),k:50,l:%273%27,n:%270%27,o:%27%27,t:%270%27)),l:%272%27,n:%270%27,o:%27%27,t:%270%27)),version:4) including a test caller with the test cases from the question.
See [Add two really big numbers](https://codegolf.stackexchange.com/questions/264867/add-two-really-big-numbers/265112#265112) re: `_BitInt`. Clang 16 supports very large widths: the current max is 8388608 bits for signed or unsigned, `_BitInt(1<<23)`. So not enough to handle values up to `INT_MAX`, but we don't handle negative `int` values either.
And yes, shifting and ANDing a 64KiB bitmap as a wide integer takes a ridiculous amount of asm instructions since clang fully unrolls it. I used `_BitInt(1<<8)` while developing this to keep edit/compile/run cycles short. With 1<<16 width, `clang16 -std=gnu89 -Os -Wall -Wno-implicit-int` makes 24249 lines of asm for x86-64 (only a couple of them labels instead of instructions.) It also uses about 30472 + 128 (red zone) = 30600 bytes of stack space. (64Kib = 8KiB)
Ungolfed:
```
typedef _BitInt(1<<8) T;   // narrower for testing with small number inputs
/* int */ ungolfed(int *p, int n){
    T bitset = 0;
    for(;n--;){
        bitset |= (T)1<<p[n];   // cast needed *before* the shift
    }
    int retval=1;            // reuse n for this in the golfed version
    // https://stackoverflow.com/questions/3304705/finding-consecutive-bit-string-of-1-or-0
    while(bitset &= bitset<<1){ // doesn't count the iteration that clears the last bit, hence retval=1 to start
        retval++;
    }
    return retval;
}
```
With `clang -fsanitize=undefined`, it will reject out-of-bounds inputs, e.g. *runtime error: shift exponent 200000 is too large for 65536-bit type 'T' (aka '\_BitInt(65536)')*
[Answer]
# Google Sheets, 61 bytes
`=sort(max(len(split(join(,frequency(A:A,sequence(9^4))),0))))`
Put the input in cells `A1:A` and the formula in `B1`.
Uses `frequency()` like the [Excel answer](https://codegolf.stackexchange.com/a/265111/119296). Does not require [CSE](https://support.microsoft.com/en-us/office/create-an-array-formula-e43e12e0-afc6-4a12-bc7f-48361075954d).
[Answer]
# Haskell + [hgl](https://www.gitlab.com/wheatwizard/haskell-golfing-library), 19 bytes
```
l<ixe(fl~<(<P1)<fe)
```
Uses [xnor's method](https://codegolf.stackexchange.com/a/265098/56656).
## 20 bytes
Here's one that works online:
```
P1<l<ih eq1<δ<sr<nb
```
[Attempt This Online!](https://ato.pxeger.com/run?1=m708I7E4OzUnZ8FN_czcgvyiEoUALiijsDQxJzMtMzVFIaAoNac0JZUrzcoq2jOvJFbXDkguLS1J07XYlmYbYGiTY5OZoZBaaGhzbotNcZFNXhJE8qZxbmJmnoKtQko-l4JCQZGCikKaQrShjpGOmY6xjomOZSySsDFQ2FjHMBaidcECCA0A)
### Explanation
* `nb` removes all duplicates from the list
* `sr` sorts the list
* `δ` gets the differences between consecutive elements
* `ih eq1` gets the longest contiguous sublist of `1`s
* `l` takes the length
* `P1` adds 1
## Reflection
Some things can be improved:
* The glue in `fl~<(<P1)<fe` is too much, there should be some helper function that can reduce the amount of glue here.
* `sr<nb` could probably be a single function.
[Answer]
# [Uiua](https://uiua.org), 12 [bytes](https://www.uiua.org/pad?src=U0JDUyDihpAgK0BcMOKKlwpEZWNvZGUg4oaQIOKHjOKKjy0x4pa9wrEu4o2Y4ouv4oav4oqCwq8x4qe74ouv4qe7LOKHjOKItSjihpjCrzHii68rMjU2KSAtQFwwKzEKJnAg4oqCIjggYml0IGVuY29kaW5nOlx0IiBTQkNTICLih4ziio8tMeKWvcKxLuKNmOKLr-KGr-KKgsKvMeKnu-KLr-Knuyzih4ziiLUo4oaYwq8x4ouvKzI1NikiIOKKgitAXDDih6ExMjkiLiziiLY74oiYwqzCscKv4oy14oia4peL4oyK4oyI4oGFPeKJoDziiaQ-4omlKy3Dl8O34pe_4oG_4oKZ4oan4oal4oig4qe74paz4oeh4oqi4oeM4pmt4ouv4o2J4o2P4o2W4oqa4oqb4oqd4pah4oqU4omF4oqf4oqC4oqP4oqh4oav4oaZ4oaY4oa74per4pa94oyV4oiK4oqXL-KIp1xc4oi14omh4oi64oqe4oqg4o2l4oqV4oqc4oip4oqT4oqD4oqZ4ouF4o2Y4o2c4o2a4qyaJz_ijaPijaQh4o6L4oas4pqCzrfPgM-E4oiefl9bXXt9KCnCr0AkXCLihpB8IyIKJnAg4oqCImRlY29kZWQ6XHQiIERlY29kZSAiwqPCsS0xwrjChy7DjMKlwrPCsMKIMcKfwqXCnyzCo8K_KMK1wogxwqUrMjU2KSIg4oqCK0BcMOKHoTEyOSIuLOKItjviiJjCrMKxwq_ijLXiiJril4vijIrijIjigYU94omgPOKJpD7iiaUrLcOXw7fil7_igb_igpnihqfihqXiiKDip7vilrPih6HiiqLih4zima3ii6_ijYnijY_ijZbiipriipviip3ilqHiipTiiYXiip_iioLiio_iiqHihq_ihpnihpjihrvil6vilr3ijJXiiIriipcv4oinXFziiLXiiaHiiLriip7iiqDijaXiipXiipziiKniipPiioPiipnii4XijZjijZzijZrirJonP-KNo-KNpCHijovihqzimoLOt8-Az4TiiJ5-X1tde30oKcKvQCRcIuKGkHwjIg==)
```
/↥⍘⊚-⇡⧻.⊝⊏⍏.
```
[Try it!](https://www.uiua.org/pad?src=RiDihpAgL-KGpeKNmOKKmi3ih6Hip7su4oqd4oqP4o2PLgoKRiBbMTAwIDQgMjAwIDEgMyAyXQojIE91dHB1dDogNCAvLyBiZWNhdXNlIG9mIFsxLCAyLCAzLCA0XQoKRiBbMSAyIDMgNCA1XQojIE91dHB1dDogNSAvLyBiZWNhdXNlIG9mIFsxLCAyLCAzLCA0LCA1XQoKRiBbMTAgOSA4IDcgNiA1XQojIE91dHB1dDogNiAvLyBiZWNhdXNlIG9mIFs1LCA2LCA3LCA4LCA5LCAxMF0KCkYgWzEgMSAxIDIgM10KIyBPdXRwdXQ6IDMgLy8gYmVjYXVzZSBvZiBbMSwgMiwgM10uCgpGIFs1XQojIE91dHB1dDogMSAvLyBObyBjb25zZWN1dGl2ZSBudW1iZXJzIGV4aXN0LiBZb3UgY2FuIGxlYXZlIHRoZSBPdXRwdXQgZW1wdHkgdG9vIG9yIG91dHB1dCAtMS4gSXQgbXVzdCBiZSBzaG93biBieSB0aGlzIG5vIGNvbnNlY3V0aXZlIG51bWJlcnMgZXhpc3QKCkYgWzcgMyA5IDUgNCAyIDhdCiMgT3V0cHV0OiA0IC8vIGJlY2F1c2Ugb2YgWzIsIDMsIDQsIDVdLg==)
```
/↥⍘⊚-⇡⧻.⊝⊏⍏.
         ⊏⍏.  # sort
        ⊝     # deduplicate
     ⇡⧻.      # copy & make series of same length
    -         # subtract
  ⍘⊚          # invert where
/↥            # maximum
```
[Answer]
# [Uiua](https://uiua.org), 8 [bytes](https://www.uiua.org/pad?src=U0JDUyDihpAgK0BcMOKKlwpEZWNvZGUg4oaQIOKHjOKKjy0x4pa9wrEu4o2Y4ouv4oav4oqCwq8x4qe74ouv4qe7LOKHjOKItSjihpjCrzHii68rMjU2KSAtQFwwKzEKJnAg4oqCIjggYml0IGVuY29kaW5nOlx0IiBTQkNTICLih4ziio8tMeKWvcKxLuKNmOKLr-KGr-KKgsKvMeKnu-KLr-Knuyzih4ziiLUo4oaYwq8x4ouvKzI1NikiIOKKgitAXDDih6ExMjkiLiziiLY74oiYwqzCscKv4oy14oia4peL4oyK4oyI4oGFPeKJoDziiaQ-4omlKy3Dl8O34pe_4oG_4oKZ4oan4oal4oig4qe74paz4oeh4oqi4oeM4pmt4ouv4o2J4o2P4o2W4oqa4oqb4oqd4pah4oqU4omF4oqf4oqC4oqP4oqh4oav4oaZ4oaY4oa74per4pa94oyV4oiK4oqXL-KIp1xc4oi14omh4oi64oqe4oqg4o2l4oqV4oqc4oip4oqT4oqD4oqZ4ouF4o2Y4o2c4o2a4qyaJz_ijaPijaQh4o6L4oas4pqCzrfPgM-E4oiefl9bXXt9KCnCr0AkXCLihpB8IyIKJnAg4oqCImRlY29kZWQ6XHQiIERlY29kZSAiwqPCsS0xwrjChy7DjMKlwrPCsMKIMcKfwqXCnyzCo8K_KMK1wogxwqUrMjU2KSIg4oqCK0BcMOKHoTEyOSIuLOKItjviiJjCrMKxwq_ijLXiiJril4vijIrijIjigYU94omgPOKJpD7iiaUrLcOXw7fil7_igb_igpnihqfihqXiiKDip7vilrPih6HiiqLih4zima3ii6_ijYnijY_ijZbiipriipviip3ilqHiipTiiYXiip_iioLiio_iiqHihq_ihpnihpjihrvil6vilr3ijJXiiIriipcv4oinXFziiLXiiaHiiLriip7iiqDijaXiipXiipziiKniipPiioPiipnii4XijZjijZzijZrirJonP-KNo-KNpCHijovihqzimoLOt8-Az4TiiJ5-X1tde30oKcKvQCRcIuKGkHwjIg==)
```
/↥⊜⧻.⍘⊚⊝
```
[Try it!](https://uiua.org/pad?src=RiDihpAgL-KGpeKKnOKnuy7ijZjiipriip0KCkYgWzEwMCA0IDIwMCAxIDMgMl0KRiBbMSAyIDMgNCA1XQpGIFsxMCA5IDggNyA2IDVdCkYgWzEgMSAxIDIgM10KRiBbNV0KRiBbNyAzIDkgNSA0IDIgOF0=)
Inspired by Dominic van Essen's [Uiua answer](https://codegolf.stackexchange.com/a/265952/97916).
```
/↥⊜⧻.⍘⊚⊝
       ⊝  # deduplicate
     ⍘⊚   # inverted where, i.e. how many times each element occurs
  ⊜⧻.     # lengths of contiguous equal elements
/↥        # maximum
```
Original answer:
# [Uiua](https://uiua.org), 18 [bytes](https://www.uiua.org/pad?src=U0JDUyDihpAgK0BcMOKKlwpEZWNvZGUg4oaQIOKHjOKKjy0x4pa9wrEu4o2Y4ouv4oav4oqCwq8x4qe74ouv4qe7LOKHjOKItSjihpjCrzHii68rMjU2KSAtQFwwKzEKJnAg4oqCIjggYml0IGVuY29kaW5nOlx0IiBTQkNTICLih4ziio8tMeKWvcKxLuKNmOKLr-KGr-KKgsKvMeKnu-KLr-Knuyzih4ziiLUo4oaYwq8x4ouvKzI1NikiIOKKgitAXDDih6ExMjkiLiziiLY74oiYwqzCscKv4oy14oia4peL4oyK4oyI4oGFPeKJoDziiaQ-4omlKy3Dl8O34pe_4oG_4oKZ4oan4oal4oig4qe74paz4oeh4oqi4oeM4pmt4ouv4o2J4o2P4o2W4oqa4oqb4oqd4pah4oqU4omF4oqf4oqC4oqP4oqh4oav4oaZ4oaY4oa74per4pa94oyV4oiK4oqXL-KIp1xc4oi14omh4oi64oqe4oqg4o2l4oqV4oqc4oip4oqT4oqD4oqZ4ouF4o2Y4o2c4o2a4qyaJz_ijaPijaQh4o6L4oas4pqCzrfPgM-E4oiefl9bXXt9KCnCr0AkXCLihpB8IyIKJnAg4oqCImRlY29kZWQ6XHQiIERlY29kZSAiwqPCsS0xwrjChy7DjMKlwrPCsMKIMcKfwqXCnyzCo8K_KMK1wogxwqUrMjU2KSIg4oqCK0BcMOKHoTEyOSIuLOKItjviiJjCrMKxwq_ijLXiiJril4vijIrijIjigYU94omgPOKJpD7iiaUrLcOXw7fil7_igb_igpnihqfihqXiiKDip7vilrPih6HiiqLih4zima3ii6_ijYnijY_ijZbiipriipviip3ilqHiipTiiYXiip_iioLiio_iiqHihq_ihpnihpjihrvil6vilr3ijJXiiIriipcv4oinXFziiLXiiaHiiLriip7iiqDijaXiipXiipziiKniipPiioPiipnii4XijZjijZzijZrirJonP-KNo-KNpCHijovihqzimoLOt8-Az4TiiJ5-X1tde30oKcKvQCRcIuKGkHwjIg==)
```
+1/↥⊜⧻.=1≡/-◫2⊝⊏⍏.
```
[Try it!](https://uiua.org/pad?src=RiDihpAgKzEv4oal4oqc4qe7Lj0x4omhLy3il6sy4oqd4oqP4o2PLgoKRiBbMTAwIDQgMjAwIDEgMyAyXQpGIFsxIDIgMyA0IDVdCkYgWzEwIDkgOCA3IDYgNV0KRiBbMSAxIDEgMiAzXQpGIFs1XQpGIFs3IDMgOSA1IDQgMiA4XQpGIFszIDUgNyA5IDExXQpGIFs3IDcgNiA2IDUgNV0=)
```
+1/↥⊜⧻.=1≡/-◫2⊝⊏⍏.
               ⊏⍏.  # sort
              ⊝     # deduplicate
            ◫2      # windows of size two
         ≡/-        # difference of each window
       =1           # change non-ones to zeros
    ⊜⧻.             # find length of each contiguous group of ones
  /↥                # maximum
+1                  # plus one
```
]