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