#include <bits/stdc++.h>
using namespace std;
const long long M = 1000000007;
long long A[200009], P[200009];
long long ans(long long l, long long r) {
  if (l + 1 >= r) return 0;
  long long m = (l + r) / 2;
  long long answ = ans(l, m) + ans(m + 1, r);
  vector<bool> cand(r - l + 2, false);
  vector<long long> C1, C2;
  long long s = 0;
  for (long long x = m; x >= l; x--) {
    if (A[x] >= s / 2) {
      cand[x - l] = true;
      C1.push_back(x);
    }
    s += A[x];
  }
  s = 0;
  for (long long x = m + 1; x <= r; x++) {
    if (A[x] >= s / 2) {
      cand[x - l] = true;
      C2.push_back(x);
    }
    s += A[x];
  }
  long long keku = 0;
  for (auto x : C1) {
    for (long long y = m + 1; y <= r; y++) {
      if (abs(x - y) >= 2 &&
          ((A[x] ^ A[y]) == (P[max(x, y) - 1] - P[min(x, y)]))) {
        answ++;
        if (cand[y - l]) keku++;
      }
    }
  }
  for (auto x : C2) {
    for (long long y = l; y <= m; y++) {
      if (abs(x - y) >= 2 &&
          ((A[x] ^ A[y]) == (P[max(x, y) - 1] - P[min(x, y)]))) {
        answ++;
        if (cand[y - l]) keku++;
      }
    }
  }
  answ -= keku / 2;
  return answ;
}
signed main() {
  ios::sync_with_stdio(false);
  cin.tie(nullptr);
  cout.tie(nullptr);
  long long n;
  cin >> n;
  for (long long i = 0; i < n; i++) cin >> A[i];
  for (long long i = 1; i < n; i++) P[i] = P[i - 1] + A[i];
  cout << ans(0, n - 1) << '\n';
}
