package main import ( "bufio" "fmt" "log" "math" "os" "sort" "strconv" ) var sc = bufio.NewScanner(os.Stdin) var buff []byte func nextString() string { sc.Scan() return sc.Text() } func nextFloat64() float64 { sc.Scan() f, err := strconv.ParseFloat(sc.Text(), 64) if err != nil { panic(err) } return f } func nextInt() int { sc.Scan() i, err := strconv.Atoi(sc.Text()) if err != nil { panic(err) } return i } func nextInts(n int) (r []int) { r = make([]int, n) for i := 0; i < n; i++ { r[i] = nextInt() } return r } var dy = []int{0, 1, 0, -1} var dx = []int{1, 0, -1, 0} var MAX = math.MaxInt64 func maxInt(a ...int) int { r := a[0] for i := 0; i < len(a); i++ { if r < a[i] { r = a[i] } } return r } func minInt(a ...int) int { r := a[0] for i := 0; i < len(a); i++ { if r > a[i] { r = a[i] } } return r } func sum(a []int) (r int) { for i := range a { r += a[i] } return r } func absInt(a int) int { if a < 0 { return -a } return a } type Pair struct { a, b int } type Pairs []Pair func (p Pairs) Len() int { return len(p) } func (p Pairs) Swap(i, j int) { p[i], p[j] = p[j], p[i] } func (p Pairs) Less(i, j int) bool { if p[i].a == p[j].a { return p[i].b < p[j].b } return p[i].a < p[j].a } func init() { sc.Split(bufio.ScanWords) sc.Buffer(buff, bufio.MaxScanTokenSize*1024) log.SetFlags(log.Lshortfile) } func main() { N := nextInt() A := nextInts(N) sort.Ints(A) ans := 1 for i := 0; i < N-1; i++ { for j := i + 1; j < N; j++ { if A[i]+1 < A[j] { ans = maxInt(ans, j-i) break } else if j == N-1 { ans = maxInt(ans, j-i+1) } } } fmt.Println(ans) }