#include <bits/stdc++.h>
using namespace std;
const long c = 1000000007;
int main() {
  int N;
  cin >> N;
  vector<long> A;
  for (int ii = 0; ii < N; ++ii) {
    long i;
    cin >> i;
    A.push_back(i);
  }
  long sum = 0;
  for (int ii = 0; ii < N; ++ii) {
    for (int jj = ii + 1; jj < N; ++jj) {
      sum += A[ii] ^ A[jj];
    }
  }
  cout << sum % c << endl;
  return 0;
}
