#include <bits/stdc++.h>
using namespace std;
using ll = long long;
int main() {
  ll t;
  cin >> t;
  ll x, i, j;
  vector<ll> v;
  while (t--) {
    cin >> x;
    v.push_back(x);
  }
  ll ans = 0;
  for (i = 0; i < v.size(); i++) {
    ll sum = 0;
    for (j = i + 1; j < v.size(); j++) {
      ll x = v[i] ^ v[j];
      sum = ((sum % 1000000007) + (x % 1000000007)) % 1000000007;
    }
    ans = ((ans % 1000000007) + (sum % 1000000007)) % 1000000007;
  }
  cout << ans % 1000000007 << endl;
  return 0;
}
