//program
//wujs QQ466816051
#include<bits/stdc++.h>
#define fi freopen("in.txt", "r", stdin)
#define dd printf("debug");
typedef long long ll;
using namespace std;
const int maxn = 200005;
int a[maxn][22], pre[maxn];


inline int read() {
	int f = 1, x = 0;
	char ch;
	do {
		ch = getchar();
		if(ch == '-') f = -1;
	} while(ch < '0' || ch > '9');
	do {
		x = x * 10 + ch - '0';
		ch = getchar();
	} while(ch >= '0' && ch <= '9');
	return f*x;
}

int judge(int l, int r) {
	if(l == r) return 1;
	int num = pre[r] - pre[l-1];
	int t, x = 0;
	for(int i = 0; i < 20; ++i) {
		t = a[l][i];
		for(int j = l+1; j <= r; ++j) {
			if(t != a[j][i]) t = 1;
			else t = 0;
		}
		x = x*2 + t;
	}
	//printf("%d\n", x);
	if(x == num) return 1;
	else return 0;
}

void init(int i, int x) {
	int j = 0;
	int t[20]; 
	while(x > 0) {
		t[j++] = x % 2;
		x /= 2;
	}
	int q = j;
	for(int p = 20-q; p < 20; p++) {
		a[i][p] = t[--j];
	}
}

int main() {
	int n, x;
	cin >> n;
	pre[0] = 0;
	for(int i = 1; i <= n; ++i) {
		x = read();
		pre[i] = pre[i-1] + x;
		init(i, x);
	}
	int cnt = 0;
	for(int i = 1; i <= n; ++i) {
		for(int j = i; j <= n; ++j) {
			if(judge(i, j))cnt ++;
		}
	}
	printf("%d", cnt);
	return 0;
}
