#include <bits/stdc++.h>
using namespace std;
long long n;
long long A[200011], B[200011];
long long preSum[200011];
long long get(long long x) {
  long long res = 0;
  while (x > 1) {
    res++;
    x >>= 1;
  }
  return res;
}
long long getSum(long long l, long long r) {
  if (l > r) return 0;
  return preSum[r] - (l == 0 ? 0 : preSum[l - 1]);
}
long long solve(long long l, long long r) {
  if (l >= r) return 0;
  long long maxK = 0;
  for (long long i = l; i <= r; i++) maxK = max(maxK, B[i]);
  vector<long long> idx;
  for (long long i = l; i <= r; i++)
    if (B[i] == maxK) idx.push_back(i);
  long long res = 0;
  long long m = (long long)idx.size();
  for (long long i = 0; i < m; i++) {
    long long L, R;
    if (i > 1)
      L = idx[i - 2] + 1;
    else
      L = l;
    if (i < m - 2)
      R = idx[i + 2] - 1;
    else
      R = r;
    for (long long j = L; j <= R; j++) {
      if (j > idx[i] and B[j] == maxK) continue;
      long long ll = min(idx[i], j);
      long long rr = max(idx[i], j);
      if (rr - ll + 1 < 3) continue;
      if ((A[idx[i]] ^ A[j]) == getSum(ll + 1, rr - 1)) res++;
    }
  }
  long long prev = l - 1;
  for (long long i = 0; i < m; i++) {
    res += solve(prev + 1, idx[i] - 1);
    prev = idx[i];
  }
  res += solve(prev + 1, r);
  return res;
}
signed main() {
  ios::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  cin >> n;
  for (long long i = 0; i < n; i++) {
    cin >> A[i];
    B[i] = get(A[i]);
    preSum[i] = A[i];
    if (i > 0) preSum[i] += preSum[i - 1];
  }
  cout << solve(0, n - 1) << endl;
  return 0;
}
