#include <bits/stdc++.h>   using namespace std;   long long a[(200020)], b[(200020)], close[100][2];   set<pair<long long, long long> > vis;   signed main() {     long long n;     cin >> n;     for (long long i = 1; i <= n; i++) scanf( %lld , &a[i]);     for (long long i = 1; i <= n; i++) b[i] = b[i - 1] + a[i];     long long ans = 0;     for (long long i = 1; i <= n; i++) {       if (i >= 3)         for (long long k = 0; k < 30; k++)           if (!(a[i] & (1 << k))) {             if (close[k][0] && i - close[k][0] > 1) {               if ((a[i] ^ a[close[k][0]]) == b[i - 1] - b[close[k][0]]) {                 if (vis.find(make_pair(close[k][0], i)) != vis.end()) continue;                 ans++;                 vis.insert(make_pair(close[k][0], i));               }             }             if (close[k][1] && i - close[k][1] > 1) {               if ((a[i] ^ a[close[k][1]]) == b[i - 1] - b[close[k][1]]) {                 if (vis.find(make_pair(close[k][1], i)) != vis.end()) continue;                 ans++;                 vis.insert(make_pair(close[k][1], i));               }             }           }       for (long long k = 0; k < 30; k++) {         if (a[i] & (1 << k)) {           close[k][1] = close[k][0];           close[k][0] = i;         }       }     }     memset(close, 0, sizeof(close));     for (long long i = n; i >= 1; i--) {       if (n - i + 1 >= 3)         for (long long k = 0; k < 30; k++)           if (!(a[i] & (1 << k))) {             if (close[k][0] && close[k][0] - i > 1) {               if ((a[i] ^ a[close[k][0]]) == b[close[k][0] - 1] - b[i]) {                 if (vis.find(make_pair(i, close[k][0])) != vis.end()) continue;                 ans++;                 vis.insert(make_pair(i, close[k][0]));               }             }             if (close[k][1] && close[k][1] - i > 1) {               if ((a[i] ^ a[close[k][1]]) == b[close[k][1] - 1] - b[i]) {                 if (vis.find(make_pair(i, close[k][1])) != vis.end()) continue;                 ans++;                 vis.insert(make_pair(i, close[k][1]));               }             }           }       for (long long k = 0; k < 30; k++) {         if (a[i] & (1 << k)) {           close[k][1] = close[k][0];           close[k][0] = i;         }       }     }     cout << ans << endl;     return 0;   }   