#include <bits/stdc++.h>
using namespace std;
int n, ans, a[200010];
int main() {
  scanf("%d", &n);
  for (int i = 1; i <= n; i++) scanf("%d", &a[i]);
  for (int l = 1; l <= n; l++) {
    long long xx = 1, tmp = 0;
    for (; xx <= a[l]; xx <<= 1)
      ;
    for (int r = l + 1; r < n; r++) {
      tmp += a[r];
      long long yy = 1;
      for (; yy <= tmp; yy <<= 1)
        ;
      if (yy > xx)
        break;
      else if (tmp == (a[l] ^ a[r + 1]) && a[r + 1] < a[l])
        ans++;
    }
  }
  for (int r = n; r >= 1; r--) {
    long long xx = 1, tmp = 0;
    for (; xx <= a[r]; xx <<= 1)
      ;
    for (int l = r - 1; l > 1; l--) {
      tmp += a[l];
      long long yy = 1;
      for (; yy <= tmp; yy <<= 1)
        ;
      if (yy > xx)
        break;
      else if (tmp == (a[l - 1] ^ a[r]) && a[r] >= a[l - 1])
        ans++;
    }
  }
  printf("%d\n", ans);
  return 0;
}
