#!/bin/python import sys import collections n = int(raw_input().strip()) a = map(int,raw_input().strip().split(' ')) hist = collections.Counter(a) distinct_values = sorted(hist.keys()) len_d = len(distinct_values) prev_val = None best = 0 temp = 0 for d in distinct_values: #print "d:", d #print "temp:", temp #print "best:", best #print "prev:", prev_val if prev_val is None: prev_val = d temp = hist[d] elif abs(d - prev_val) <= 1: temp += hist[d] if temp > best: best = temp temp = hist[d] prev_val = d print best