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