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