#include <bits/stdc++.h>
using namespace std;
using ll = long long;
template <class T>
inline bool chmin(T& a, T b) {
  if (a > b) {
    a = b;
    return true;
  }
  return false;
}
template <class T>
inline bool chmax(T& a, T b) {
  if (a < b) {
    a = b;
    return true;
  }
  return false;
}
bool coY() { cout << "Yes" << endl; }
bool coN() { cout << "No" << endl; }
const ll INF = 1LL << 60;
ll n, m;
string s;
const int mod = 1e9 + 7;
int main() {
  cin >> n;
  vector<ll> A(n);
  for (int i = (0); i < (n); ++i) cin >> A[i];
  ll total = 0;
  for (int i = 0; i < n; i++) {
    total ^= A[i];
  }
  ll ans = 0;
  for (int i = (0); i < (n); ++i) {
    A[i] = total ^ A[i];
  }
  for (int i = (0); i < (n); ++i) {
    for (int j = i + 1; j < n; j++) {
      ans += A[i] ^ A[j];
      ans %= mod;
    }
  }
  cout << ans << endl;
}
