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