package baidu; import java.util.Arrays; import java.util.Scanner; public class Problem22 { public static long solve(long[] array) { int len = array.length; int res = 0; Arrays.sort(array); if(array[len-1]<len) return 0; long a = array[len-1]; int index = len - 2; long b = array[index]...