#include <bits/stdc++.h>
using namespace std;
const int MX = 200005, LG = 35;
int n, a[MX], b[MX];
long long res, acu[MX];
vector<int> pos[MX];
long long sum(int i, int j) {
  if (i > j) return -1;
  if (i) return acu[j] - acu[i - 1];
  return acu[j];
}
bool valid(int i, int j) {
  return a[i] < a[j] && (a[i] ^ a[j]) == sum(i + 1, j - 1);
}
int msb(long long n) {
  long long x;
  for (int j = 0; j < (60); j++)
    if (n & (1ll << j)) x = j;
  return x;
}
void solve() {
  for (int i = 0; i < (LG); i++) pos[i].clear();
  for (int i = 0; i < (n); i++) {
    pos[b[i] = msb(a[i])].push_back(i);
    acu[i] = a[i];
    if (i) acu[i] += acu[i - 1];
  }
  for (int i = 0; i < (n); i++)
    for (int j = b[i]; j < LG; j++) {
      int k = lower_bound(acu, acu + n, acu[i] + (1ll << j)) - acu;
      if (j == b[i]) k = i;
      int l = upper_bound(pos[j].begin(), pos[j].end(), k) - pos[j].begin();
      if (l < pos[j].size()) res += valid(i, pos[j][l]);
    }
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cin >> n;
  for (int i = 0; i < (n); i++) cin >> a[i];
  solve();
  reverse(a, a + n);
  solve();
  cout << res << '\n';
  return 0;
}
