import java.util.*; // 注意类名必须为 Main, 不要有任何 package xxx 信息 public class Main { public static void main(String[] args) { Scanner in = new Scanner(System.in); // 注意 hasNext 和 hasNextLine 的区别 while (in.hasNextInt()) { // 注意 while 处理多个 case int n = in.nextInt(); int[] arr = new int[n]; for (int i = 0; i < arr.length; i++) { arr[i] = in.nextInt(); } Arrays.sort(arr); int[] cou = {0}; count(arr, 0, 1, 0, 0, cou); System.out.println(cou[0]); } } public static void count(int[] arr, int sum, int mul, int layer,int index, int[] cou) { for (int i = index; i < arr.length; i++) { if (i != index && arr[i] == arr[i-1]) { continue; } if (layer == 0 || sum+arr[i] > mul*arr[i]) { if (layer != 0) { cou[0]++; } count(arr, sum+arr[i], mul*arr[i], layer+1, i+1, cou); }else { break; } } } }