#include <bits/stdc++.h>
using namespace std;
int N;
long long *A;
void Solve() {
  long long sum = 0LL;
  for (int i = 1; i < N; ++i) {
    for (int j = i + 1; j <= N; ++j) {
      long long exor = A[i] xor A[j];
      sum += ((exor) % 1000000007);
    }
    sum = ((sum) % 1000000007);
  }
  cout << sum << endl;
}
void Init() {
  cin >> N;
  A = new long long[N + 2];
  for (int i = 1; i <= N; ++i) cin >> A[i];
}
void Clean() { delete[] A; }
int main() {
  Init();
  Solve();
  Clean();
  return 0;
}
