import java.util.*;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int[] arr = new int[n];
        for (int i = 0; i < n; i++) {
            arr[i] = sc.nextInt();
        }
        Arrays.sort(arr);
        System.out.println(count(arr, n, 0, 0, 1));
    }

    static int count(int[] arr, int n, int pos, int sum, int multi) {
        int count = 0;
        for (int i = pos; i < n; i++) {
            sum += arr[i];
            multi *= arr[i];
            if (sum > multi) {
                count = count + 1 + count(arr, n, i + 1, sum, multi);
            } else if (arr[i] == 1) {
                count = count + count(arr, n, i + 1, sum, multi);
            } else {
                break;
            }
            sum -= arr[i];
            multi /= arr[i];
            while (i < n - 1 && arr[i] == arr[i + 1]) {
                i++;
            }
        }
        return count;
    }
}