@@ -0,0 +1,630 @@
+import java.io.*;%0Aimport java.util.*;%0Aimport java.text.*;%0Aimport java.math.*;%0Aimport java.util.regex.*;%0A%0Apublic class Solution %7B%0A%0A  public static int toys(int%5B%5D arr) %7B%0A    Arrays.sort(arr);%0A    int counter = 0;%0A    int max = -1;%0A    for (int i = 0; i %3C arr.length; i++) %7B%0A      if (arr%5Bi%5D %3E max) %7B%0A        counter++;%0A        max = arr%5Bi%5D + 4;%0A      %7D%0A    %7D%0A    return counter;%0A  %7D%0A%0A  public static void main(String%5B%5D args) %7B%0A    Scanner in = new Scanner(System.in);%0A    int t = in.nextInt();%0A    int%5B%5D arr = new int%5Bt%5D;%0A    for (int i = 0; i %3C t; i++) %7B%0A      arr%5Bi%5D = in.nextInt();%0A    %7D%0A    System.out.println(toys(arr));%0A  %7D%0A%7D%0A

add topcoder solution