#include <bits/stdc++.h>
using namespace std;
using ll = int64_t;
const int MOD = 1000000007;
int main() {
  int n;
  cin >> n;
  vector<ll> a(n);
  for (int i = (int)(0); i < (int)(n); i++) cin >> a[i];
  ll sum = 0;
  for (int i = (int)(0); i < (int)(n - 1); i++) {
    for (int k = (int)(i + 1); k < (int)(n); k++) {
      sum = (sum + (a[i] ^ a[k]) % MOD) % MOD;
    }
  }
  cout << sum << endl;
}
