#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define fi first
#define se second
#define MOD 1000000007
#define FOR(i,a,b) for (int i = (a);i <= (b);i++)
#define FOD(i,a,b) for (int i = (b);i >= (a);i--)
#define ALL(x) (x).begin(),(x).end()
#define ii pair<ll,ll>
#define iii pair<int,pair<int,int>>
//const int MOD = 998244353;
const int MAXN = 1e5 + 7;
const ll oo = 9e18;
int a[MAXN],n;
vector<ll> v;
bool f[19];
ll ans = -oo;
void check(int id,ll cur){
    if (!id){
        ans = max(ans,cur);
        return ;
    }
    FOR(i,1,9)if (!f[i]){
        f[i] = true;
        FOR(j,i + 1,9)if (!f[j]){
            f[j] = true;
            FOR(k,j + 1,9)if (!f[k]){
                f[k] = true;
                check(id - 1,cur + v[i] * v[j] * v[k]);
                f[k] = false;
            }
            f[j] = false;
        }
        f[i] = false;
    }
}
void sub1(int mask = n){
	int cnt = 0;
    FOR(i,1,(1<<mask) - 1)
    if (__builtin_popcount(i) == 9){
    	cnt++;
        v.clear();v.push_back(0);
        FOR(j,0,mask - 1)if (i >> j & 1)
        v.push_back(a[j + 1]);
        //check(3,0);
    }
    cout << cnt;
}
void sub2(){

}
int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(0); cout.tie(0);
    cin >> n;
    FOR(i,1,n)cin >> a[i];
    if (n <= 18)sub1();
    else sub2();
    return 0^0;
}