#include <bits/stdc++.h>
using namespace std;
int main() {
  int N;
  cin >> N;
  vector<long long> A(N);
  for (int i = 0; i < N; ++i) cin >> A[i];
  long long ans = 0;
  for (int i = 0; i < N - 1; ++i) {
    for (int j = i + 1; j < N; ++j) {
      ans += A[i] ^ A[j];
    }
  }
  int per = pow(10, 9) + 7;
  int mod = ans % per;
  cout << mod << endl;
}
