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