#include <bits/stdc++.h>
using namespace std;
int N;
vector<unsigned long> A;
int main() {
  cin >> N;
  A.resize(N);
  for (int i = 0; i < N; i++) {
    cin >> A[i];
  }
  unsigned long ans = 0;
  unsigned long warukazu = pow(10, 9) + 7;
  for (int i = 0; i < N; i++) {
    for (int j = i + 1; j < N; j++) {
      ans += (A[i] ^ A[j]);
    }
  }
  cout << ans % warukazu << endl;
}
