#include <iostream>
#include <iomanip>
#include <cstdio>
#include <set>
#include <vector>
#include <map>
#include <cmath>
#include <algorithm>
#include <memory.h>
#include <string>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <cassert>
#include <sstream>
 
using namespace std;
 
const string TASKNAME = "hack";
 
map < int, set <int> > mp;
pair <int, int> e[42];
int lz[42];
int a[123456], id[123456];
set <int>::iterator it;
 
int main() {
  freopen((TASKNAME + ".in").c_str(), "r", stdin);
  freopen((TASKNAME + ".out").c_str(), "w", stdout);
  int n;
  scanf("%d", &n);
  for (int i = 1; i <= n; i++) scanf("%d", a + i);
  for (int j = 0; j <= 30; j++) lz[j] = 0;
  mp.clear();
  int x = 0;
  id[0] = 1;
  mp[0].insert(0);
  long long ans = 0;
  for (int i = 1; i <= n; i++) {
    x ^= a[i];
    for (int j = 0; j <= 30; j++)
      if (!(a[i] & (1 << j))) lz[j] = i;
    for (int j = 0; j <= 30; j++) e[j] = make_pair(lz[j], j);
    e[31] = make_pair(0, 31);
    e[32] = make_pair(i, 32);
    sort(e, e + 33);
    int beg = 0;
    int a = 0;
    while (beg < 33) {
      int end = beg;
      while (end + 1 < 33 && e[beg].first == e[end + 1].first) end++;
      for (int q = beg; q <= end; q++)
        if (e[q].second < 31) a += (1 << e[q].second);
      int from = e[beg].first + 1;
      int to = e[end + 1].first;
      if (from <= to) {
        from--; to--;
        int need = x ^ a;
        if (mp.find(need) != mp.end()) {
          it = mp[need].lower_bound(from);
          if (it != mp[need].end()) {
            int st = id[*it];
            it = mp[need].lower_bound(to + 1);
            if (it != mp[need].begin()) {
              it--;
              int fin = id[*it];
              ans += fin - st + 1;
            }
          }
        }
      }
      beg = end + 1;
    }
    id[i] = mp[x].size() + 1;
    mp[x].insert(i);
  }
  cout << ans << endl;
  return 0;
}