#include<stdio.h>
#include<math.h>
int main() {
    int n;
    scanf("%d", &n);
    int i, j, ans, weight, A[n], B[n];
    for (j = 0; j < n; j++)scanf("%d", &B[j]);
    j = ans = weight = 0;
    for (i = 0; i < n; i++) {
        A[i] = 0;
    }
    for (i = 0; i < pow(2, n); i++) {
        A[n - 1]++;
        for (j = n - 1; j > 0; j--) {
            if (A[j] >= 2) {
                A[j - 1] += A[j] / 2;
                A[j] = A[j] % 2;
            }
        }
        for (j = 0; j < n; j++)weight += B[j] * A[j];
        if (weight == 40)ans++;
        weight = 0;
    }
    printf("%d", ans);


}