import std.stdio, std.string, std.conv, std.algorithm;

void main(string[] args) {
  readln();
  auto a = readln().chomp.split.map!(to!int);
  int[] t;
  void f(int i){if(t.length<=i){t.length=i+1;} t[i]++;}
  foreach(int i; a){
    if(i>0){ f(i-1); }
    f(i);
    f(i+1);
  }
  t.reduce!max.writeln;
}