Scanf.scanf "%d" (fun n ->
    let hist = Array.make 100002 0 in
    for i = 1 to n do
        Scanf.scanf " %d" (fun a ->
            hist.(a    ) <- hist.(a    ) + 1;
            hist.(a + 1) <- hist.(a + 1) + 1;
            hist.(a + 2) <- hist.(a + 2) + 1;
       )
    done;
    Array.fold_left max 0 hist |> Printf.printf "%d\n"
)