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