#include <bits/stdc++.h>
using namespace std;
int main() {
  int N;
  cin >> N;
  vector<long long> A(N);
  for (auto &x : A) {
    cin >> x;
  }
  long long r = 0;
  for (int i = 0; i < N - 1; i++) {
    for (int j = i + 1; j < N; j++) {
      r = (r + (A[i] ^ A[j])) % (1000000000 + 7);
    }
  }
  cout << r << endl;
}
