#include <bits/stdc++.h>
using namespace std;
using ll = long long;
int main() {
  const ll mod = 1000000007;
  ll n;
  cin >> n;
  vector<ll> a(n);
  for (ll i = 0; i < n; ++i) {
    ll x;
    cin >> x;
    a[i] = x;
  }
  ll res = 0;
  for (ll i = 0; i < n - 1; ++i) {
    for (ll j = i; j < n; ++j) {
      ll t = a[i] ^ a[j];
      res = (res + t) % mod;
    }
  }
  cout << res << endl;
}
