#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using P = pair<ll, ll>;
using Map = map<string, ll>;
ll MOD = 1000000007;
int main() {
  ll N;
  cin >> N;
  vector<ll> A(N, 0);
  for (int i = 0; i < N; i++) {
    cin >> A[i];
  }
  ll ans = 0;
  for (int i = 0; i < N - 1; i++) {
    for (int j = i + 1; j < N; j++) {
      ans += A[i] ^ A[j];
      ans %= MOD;
    };
  }
  cout << ans << endl;
  return 0;
}
