#include <bits/stdc++.h>
using namespace std;
using ll = long long;
int main() {
  int MOD = 1e9 + 7;
  ll N;
  cin >> N;
  vector<ll> A(N);
  for (ll i = 0; i < N; i++) {
    cin >> A[i];
  }
  ll ans = 0;
  for (ll i = 0; i < N; i++) {
    for (ll j = i + 1; j < N; j++) {
      ans = (ans + (A[i] ^ A[j])) % MOD;
    }
  }
  cout << ans << endl;
}
