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