module IMap=Map.Make(struct type t=int let compare=compare end);;
Scanf.(Array.(scanf" %d"@@ fun n->
	let m = init n(fun _->scanf" %d"@@fun v->v)
	|> fold_left(fun m v->IMap.add v (1+try IMap.find v m with Not_found -> 0) m) IMap.empty
	in IMap.fold(fun v c r->
		let p,q=(try IMap.find (v-1) m with Not_found->0),(try IMap.find (v+1) m with Not_found->0)
		in max r (p+q+c)) m 0 |> print_int))