#include <bits/stdc++.h>
using namespace std;
int main() {
  int N;
  long int *A;
  A = new long int[300001];
  long long int ans = 0;
  cin >> N;
  for (int i = 0; i < N; i++) {
    long long int num;
    cin >> num;
    if (num > 0x3dddddddd) {
      num = num & 0x3dddddddd;
    }
    A[i] = num;
  }
  for (int i = 0; i < N - 1; i++) {
    for (int j = i + 1; j < N; j++) {
      ans += A[i] ^ A[j];
    }
  }
  cout << ans % 1000000007 << endl;
  return 0;
}
