from collections import defaultdict





def main():

    n = int(eval(input()))

    a = [int(an) for an in input().split()]

    cnt = defaultdict(int)

    for an in a:

        for val in {an - 1, an, an + 1}:

            cnt[val] += 1

    print((max(cnt.values())))





if __name__ == "__main__":

    main()

from collections import defaultdict





def main():

    _ = eval(input())

    a = [int(an) for an in input().split()]

    cnt = defaultdict(int)

    for an in a:

        cnt[an - 1] += 1

        cnt[an] += 1

        cnt[an + 1] += 1

    print((max(cnt.values())))





if __name__ == "__main__":

    main()

from collections import defaultdict


def main():
    n = int(eval(input()))
    a = [int(an) for an in input().split()]
    cnt = defaultdict(int)
    for an in a:
        for val in {an - 1, an, an + 1}:
            cnt[val] += 1
    print((max(cnt.values())))


if __name__ == "__main__":
    main()

from collections import defaultdict


def main():
    _ = eval(input())
    a = [int(an) for an in input().split()]
    cnt = defaultdict(int)
    for an in a:
        cnt[an - 1] += 1
        cnt[an] += 1
        cnt[an + 1] += 1
    print((max(cnt.values())))


if __name__ == "__main__":
    main()

-    n = int(eval(input())) +    _ = eval(input()) -        for val in {an - 1, an, an + 1}: -            cnt[val] += 1 +        cnt[an - 1] += 1 +        cnt[an] += 1 +        cnt[an + 1] += 1