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