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