#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0; i<(n); i++)
#define pb push_back
#define all(v) (v).begin(),(v).end()
#define fi first
#define se second
#define sz(x) ((int)(x).size())
using ll=long long;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
#define MOD  1000000007
const ll INF=1e18;
template<class T>void show(vector<T>v){for (int i = 0; i < v.size(); i++){cerr<<v[i]<<" ";}cerr<<endl;}
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b){ a = b; return 1; } return 0; }



int main(int argc, char const *argv[]) {
  int n;
  cin >> n;
  vector<ll> a(n);
  rep(i,n) cin >> a[i];
  ll ans = 0;
  for (int bit = 0; bit < 60; bit++){
    ll one = 0;
    rep(i, n) if (a[i] & 1ll << bit) one++;
    ans = ll(ans%MOD + (1ll << bit) % MOD * one%MOD * (n - one)%MOD) % MOD;
  }
  cout << ans << endl;
  return 0;
}
//Δ_E
#include<iostream>
#include<cstdio>
#include<fstream>
#include<algorithm>
#include<vector>
#include<map>
#include<set>
#include<queue>
#include<bitset>
#include<cmath>
#include<cstring>
#include<cstdlib>
using namespace std;
typedef long long LL;
typedef double DB;
const int N = 1<<20;
const int MO = 1e9+7;
int n,m,a[N],b[N],s[N];
vector<int> v[N];
int cal(int o,int f=0){
	int i,j,x,y;
	x=1,y=0;
	for(i=0;i<v[o].size();i=i+1){
		j=v[o][i];
		y=(y+x)%MO;
		if(i+1<v[o].size())
			x=(x+(LL)y*(s[v[o][i+1]]-s[j])%MO)%MO;
	}
	if(f)
		return x;
	return y;
}
int main()
{
	int i,x,o;
	scanf("%d",&n);
	for(i=1;i<=n;i=i+1){
		scanf("%d",a+i);
		m^=a[i];
		b[i]=b[i-1]^a[i];
		s[i]=s[i-1];
		if(!b[i])
			s[i]++;
	}
	for(i=1;i<n;i=i+1)
		v[b[i]].push_back(i);
	if(m){
		v[m].push_back(n);
		cout<<cal(m,1);
		return 0;
	}
	x=0;
	for(i=1;i<N;i=i+1)
		x=(x+cal(i))%MO;
	o=1;
	for(i=1;i<=s[n-1];i=i+1)
		o=o*2%MO;
	cout<<(x+o)%MO;
	return 0;
}