#include <bits/stdc++.h>
using namespace std;
using Graph = vector<vector<int>>;
const long long INF = 2e9;
const long long large_P = 1e9 + 7;
signed main() {
  long long N;
  cin >> N;
  vector<long long> A(N);
  for (long long i = 0; i < (N); i++) cin >> A.at(i);
  long long res = 0;
  for (long long i = 0; i < (N - 1); i++) {
    for (long long j = i + 1; j < N; j++) {
      res += (A.at(i) xor A.at(j));
      res %= large_P;
    }
  }
  cout << res << endl;
}
