#include <bits/stdc++.h>
using namespace std;
void solve() {
  int n;
  cin >> n;
  vector<int64_t> a(n);
  for (int i = 0; i < n; i++) cin >> a[i];
  int64_t res = 0;
  for (int l = 0; l < 30; l++) {
    for (int i = 0; i < n; i++) {
      if (a[i] & ((int64_t)1 << l)) {
        int64_t cur = 0;
        for (int j = i + 2; j < n; j++) {
          cur += a[j - 1];
          if (cur >= ((int64_t)2 << l)) break;
          if (cur < ((int64_t)1 << l)) continue;
          if ((a[i] ^ a[j]) == cur) ++res;
        }
        {
          int64_t cur = 0;
          for (int j = i - 2; j >= 0; j--) {
            cur += a[j + 1];
            if (cur >= ((int64_t)2 << l)) break;
            if (cur < ((int64_t)1 << l)) continue;
            if ((a[i] ^ a[j]) == cur) ++res;
          }
        }
      }
    }
  }
  cout << res;
}
int main() {
  int t = 1;
  while (t--) solve();
  return 0;
}
