import java.util.*;

// 注意类名必须为 Main, 不要有任何 package xxx 信息
public class Main {
    public static void main(String[] args) {
        Scanner sc=new Scanner(System.in);
        while (sc.hasNext()){
            int n=sc.nextInt();
            int[] arr=new int[n];
            for (int i = 0; i < n; i++) {
                arr[i]=sc.nextInt();
            }
            Arrays.sort(arr);
            int num=count(arr,n,0,0,1);
            System.out.println(num);
        }
    }
    public 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=sum-arr[i];
            multi=multi/arr[i];
            while (i<n-1&&arr[i]==arr[i+1]){
                i++;
            }
        }
        return count;
    }
}