#include <iostream>
#include <cstdio>
#include <vector>
#include <set>
#include <cassert>

using namespace std;

int n;
int a[1 << 17];

int main() {
 	freopen("subsequences.in", "r", stdin);
	freopen("subsequences.out", "w", stdout);

	cin >> n;
	assert(n <= 10);
	for (int i = 0; i < n; i++) {
	 	cin >> a[i];
	}

	int ans = 0;
	for (int l = 0; l < n; l++) {
	 	for (int r = l; r < n; r++) {
			set<vector<int> > st;
	 	 	for (int mask = 0; mask < 1 << (r - l + 1); mask++) {
				vector<int> v;
				for (int i = l; i <= r; i++) {
				 	if (mask & (1 << (i - l))) {
				 	 	v.push_back(a[i]);
					}
				}
				st.insert(v);
			}
			ans += st.size();
		}
	}
	cout << ans << endl;

	return 0;
}