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