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