#include <bits/stdc++.h>
using namespace std;
int main() {
  int64_t con = 1000000007LL;
  int N;
  cin >> N;
  vector<int64_t> A(N);
  for (int i = 0; i < N; i++) {
    int64_t Ai;
    cin >> Ai;
    A.at(i) = Ai;
  }
  int64_t sum = 0;
  for (int i = 0; i < N - 1; i++) {
    for (int j = i + 1; j < N; j++) {
      sum += (A.at(i) ^ A.at(j)) % con;
      sum %= con;
    }
  }
  cout << sum << endl;
}
