#include <bits/stdc++.h>
using namespace std;
long long int Pow(long long int a, long long int b, long long int md,
                  long long int ans = 1) {
  for (; b; b >>= 1, a = a * a % md)
    if (b & 1) ans = ans * a % md;
  return ans;
}
const long long int MAXN = 2e5 + 10;
const long long int INF = 8e18;
const long long int MOD = 1e9 + 7;
long long int P[2][MAXN], A[MAXN], ans = 0, n;
map<pair<long long int, long long int>, long long int> mp;
void solve(long long int l = 1, long long int r = n + 1) {
  if (r - l < 3) return;
  long long int mid = (l + r) >> 1;
  P[0][mid] = P[1][mid - 1] = 0;
  for (long long int i = mid; i < r; i++) P[1][i] = P[1][i - 1] + A[i];
  for (long long int i = mid - 1; i >= l; i--) P[0][i] = P[0][i + 1] + A[i];
  for (long long int i = mid; i < r; i++) {
    if (P[1][i - 1] > A[i]) continue;
    for (long long int j = l; j < mid; j++) {
      if (A[j] ^ A[i] ^ (P[0][j + 1] + P[1][i - 1])) continue;
      if (i - j + 1 < 3 || mp[{j, i}]) continue;
      ans++;
      mp[{j, i}] = 1;
    }
  }
  for (long long int i = l; i < mid; i++) {
    if (P[0][i + 1] > A[i]) continue;
    for (long long int j = mid; j < r; j++) {
      if (A[j] ^ A[i] ^ (P[1][j - 1] + P[0][i + 1])) continue;
      if (j - i + 1 < 3 || mp[{i, j}]) continue;
      ans++;
      mp[{i, j}] = 1;
    }
  }
  mp.clear();
  solve(l, mid), solve(mid, r);
}
int main() {
  scanf("%lld", &n);
  for (long long int i = 1; i <= n; i++) scanf("%lld", &A[i]);
  solve();
  printf("%lld\n", ans);
  return 0;
}
