#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  int n;
  cin >> n;
  vector<long long> a(n);
  for (int i = 0; i < n; i++) cin >> a[i];
  vector<long long> pre(n);
  for (int i = 0; i < n; i++) {
    if (i == 0) {
      pre[i] = a[i];
      continue;
    }
    pre[i] = pre[i - 1] + a[i];
  }
  auto high = [&](long long n) -> int {
    int ans = 0;
    while (n > 0) {
      ans++;
      n >>= 1;
    }
    return ans - 1;
  };
  set<pair<int, int> > ans;
  auto solve = [&](bool invert) {
    for (int l = 0; l < n; l++) {
      int h = high(a[l]);
      for (int r = l + 2; r < n; r++) {
        long long sum =
            invert ? pre[n - l - 2] - pre[n - 1 - r] : pre[r - 1] - pre[l];
        if (sum >= (1LL << (h + 1))) break;
        if ((a[r] ^ a[l]) == sum) {
          ans.insert(invert ? make_pair(n - 1 - r, n - 1 - l)
                            : make_pair(l, r));
        }
      }
    }
  };
  solve(0);
  reverse(a.begin(), a.end());
  solve(1);
  cout << ans.size() << endl;
  return 0;
}
