//................ DON'T WISH IT WERE EASIER, WISH YOU WERE BETTER........................
//............ WHEN LIFE PUTS YOU IN TOUGH SITUATIONS, DONT SAY "WHY ME" SAY "TRY ME".......

#include <bits/stdc++.h>
#define fast ios_base::sync_with_stdio(false); cin.tie(0);cout.tie(0);
#define pb emplace_back
#define endl "\n"
#define f first
#define mp make_pair
#define s1 second
#define delrep  v.erase(unique(v.begin(),v.end()),v.end());
#define all(a)  (a).begin(),(a).end()
#define sz(x)   (int)x.size()
#define lll __int64
const int N=1e6+10;
const int mod=998244353;
using namespace std;
typedef long long ll;
int get_second( pair<int, int> i ){ return i.second; } 
ll power(ll x,ll y){int res=1;x=x%mod;while(y>0){if(y&1)res=(res*x)%mod;y=y>>1;x=(x*x)%mod;}return res;}
int trail_zero(int n){while (n % 10 == 0) n /= 10 ; return n;}
map<ll,ll> mc;
multiset<ll> s1;
map<pair<ll,ll>,ll> m1;
vector<pair<int,int>>vxx;
vector<int>val(N);
map<char,int>m4;
map<char,int>m5;
char s111[N];
ll p2[N],p3[N];
//ll h[N];
ll n,k,m,x,ans=0,q,y,ans1=INT_MAX;
bool check(int a,int b) { if(a>=0 || a<n) return true; if(b>=0 || b<m) return true; else return false;}
int idx[]={0,-1,0,1};
int idy[]={1,0,-1,0};
char a5[505][505];
vector<vector<ll>> adj(N); vector<ll> a(N);
vector<ll> vis(N),out(N); bool visx[505][505];
vector<ll>b(N);
vector<pair<ll,ll>>v2;
map<ll,ll>mxx;
int xxx[111][111]; int used[100][100];
vector<pair<int, int>> e, o(100002);
pair<ll,ll> root;
bool prime_check(ll a)
{
    if(a == 2)
        return true;
    for(ll i=2;i<=sqrt(a);i++)
    {
        if(a%i)
            continue;
        return false;
    }
    return true;
}
int smallest_divisor(ll a)
{
  for(int i=2;i*i<=a;i++)
  {
    if(a%i==0) return i;
  }
  return a;
}
bool con(char c)
{
    if(c!='a'&&c!='e'&&c!='i'&&c!='o'&&c!='u')
    return true;
    else
    return false;
}
 ll f[N], g[N], h[N];  ll az[3];
 int checkr(int x,int y)
 {
  ll sum=0;
  for(int i=x;i<=y;i++) for(int j=1;j<=m;j++) sum+=xxx[i][j];
  return sum;

 }
  int checkc(int x,int y)
 {
  ll sum=0;
  for(int i=x;i<=y;i++) for(int j=1;j<=n;j++) sum+=xxx[j][i];
  return sum;

 }
int max_ans=0; int t=0,l=0,cnt=0;
ll ind[100000],mx=0;
vector<ll>color(N);
set<ll>s2[N];
inline bool in (int x , int y) { return 1 <= x && x <n+1 && 1<= y && y <m+1; }
void dfs( ll x)
{
    vis[x] = 1;
    if(b[x]>m) return;
    cnt=0;
    for (auto i : adj[x])
    {
        if (vis[i]) continue;
        if(a[i]==1) b[i]=b[x]+1; else b[i]=0;
        dfs(i);
        cnt++;
    }
    if (cnt == 0) ans++;
}
ll a3[N],v22[N];
//vector<pair<char,int>>x;
string names[N];
int slidw[N];
map<string,int>m3,m2;
set<ll>s3;
vector<long long> v;
void brutedfs(ll x,ll y,ll z)
{
  if (x>10000000000) return;
  if(y==z) s3.insert(x);
  brutedfs(x*10+4,y+1,z);
  brutedfs(x*10+7,y,z+1);
}
ll xo[N];
ll can(ll x)
 {
     ll sum=0; 
    for(int i=n/2;i<n;i++) sum+=max(0LL,x-a[i]);
    if(sum<=k) return true; else return false;
 }
 int haito(ll r, ll l) {  return p2[r]-p2[l-1]!=(xo[r]^xo[l-1]);   }
int main() 
{
   ll n; cin>>n; ll a[n+1]; for(int i=1;i<=n;i++) cin>>a[i];
   for(int i=1;i<=n;i++) { p2[i]=p2[i-1]+a[i]; xo[i]=xo[i-1]^a[i];    }
   ll l=1;
   for(int r=1;r<=n;r++)
   {
    while(haito(r,l)) { l++; }
    ans+=r-l+1;
   }
   cout<<ans;
}


                                

Measured memory_bytes: 140160