#include <bits/stdc++.h>
using namespace std;
const unsigned long long int n = 1000000007;
int main() {
  int N;
  cin >> N;
  vector<unsigned long long int> A(N);
  for (int i = 0; i < N; i++) {
    cin >> A[i];
    A[i] %= 10000000000;
  }
  unsigned long long int answer = 0;
  for (int i = 0; i < N - 1; i++) {
    for (int j = i + 1; j < N; j++) {
      if (i == j) continue;
      answer += (A[i] ^ A[j]) % n;
    }
  }
  cout << answer % n << endl;
  return 0;
}
