//土尔逊Torson 编写于2023/06/16
#define _CRT_SECURE_NO_WARNINGS
#include <iostream>
#include <algorithm>

using namespace std;

const int MAXN = 20;
int n;
int count12401;

void DFS12401(int m[], int total, int pos) {
	if (total == 40) {
		count12401++;
		return;
	}
	else {
		for (int i = pos; i < n; ++i) {
			DFS12401(m, total + m[i], i + 1);
		}
	}
}

int main() {
	while (scanf("%d", &n) != EOF) {
		int m[MAXN];
		for (int i = 0; i < n; ++i) {
			scanf("%d", &m[i]);
		}
		sort(m, m + n);
		DFS12401(m, 0, 0);
		printf("%d\n", count12401);
	}
}
// 64 位输出请用 printf("%lld")