#include <bits/stdc++.h>
using namespace std;
template <typename T>
void out(T x) {
  cout << x << endl;
  exit(0);
}
using ll = long long;
const int maxn = 1e6 + 5;
int n;
ll a[maxn];
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  cin >> n;
  for (int i = 0; i < n; i++) {
    cin >> a[i];
  }
  ll res = 0;
  for (int j = 0; j < 30; j++) {
    for (int l = 0; l < n; l++) {
      if (a[l] >> j & 1) {
        {
          ll sum = 0;
          for (int r = l + 2; r < n; r++) {
            sum += a[r - 1];
            if (sum >= (2ll << j)) break;
            if (sum < (1ll << j)) continue;
            if (sum == (a[l] ^ a[r])) res++;
          }
        }
        {
          ll sum = 0;
          for (int r = l - 2; r >= 0; r--) {
            sum += a[r + 1];
            if (sum >= (2ll << j)) break;
            if (sum < (1ll << j)) continue;
            if (sum == (a[r] ^ a[l])) res++;
          }
        }
      }
    }
  }
  cout << res << endl;
  return 0;
}
