@@ -0,0 +1,1258 @@
+/**%0A * Copyright 2015-2016 Debmalya Jash%0A * %3Cp/%3E%0A * Licensed under the Apache License, Version 2.0 (the %22License%22);%0A * you may not use this file except in compliance with the License.%0A * You may obtain a copy of the License at%0A * %3Cp/%3E%0A * http://www.apache.org/licenses/LICENSE-2.0%0A * %3Cp/%3E%0A * Unless required by applicable law or agreed to in writing, software%0A * distributed under the License is distributed on an %22AS IS%22 BASIS,%0A * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.%0A * See the License for the specific language governing permissions and%0A * limitations under the License.%0A */%0Apackage hr;%0A%0Aimport java.util.Arrays;%0Aimport java.util.Scanner;%0A%0A/**%0A * @author debmalyajash%0A *%0A */%0Apublic class PickingNumber %7B%0A%0A%09/**%0A%09 * @param args%0A%09 */%0A%09public static void main(String%5B%5D args) %7B%0A%09%09try (Scanner in = new Scanner(System.in)) %7B%0A%09%09%09int n = in.nextInt();%0A%09%09%09int%5B%5D a = new int%5Bn%5D;%0A%09%09%09for (int a_i = 0; a_i %3C n; a_i++) %7B%0A%09%09%09%09a%5Ba_i%5D = in.nextInt();%0A%09%09%09%7D%0A%0A%09%09%09Arrays.sort(a);%0A%0A%09%09%09int m  = 0;%0A%09%09%09for (int i = 0, j = a.length -1; i %3C j; i++,j--) %7B%0A%09%09%09%09if (Math.abs(a%5Bi%5D - a%5Bj%5D) %3C= 1) %7B%0A%09%09%09%09%09%0A%09%09%09%09%09while (i %3E -1 && Math.abs(a%5Bi%5D - a%5Bj%5D) %3C=1) %7B%0A%09%09%09%09%09%09i--;%0A%09%09%09%09%09%7D%0A%09%09%09%09%09m = j - i;%0A%09%09%09%09%09break;%0A%09%09%09%09%7D%0A%09%09%09%7D%0A%09%09%09System.out.println(m);%0A%09%09%7D%0A%0A%09%7D%0A%0A%7D%0A

Pick the number