#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  cin >> n;
  int64_t aaa[n];
  for (int x = 0; x < n; x++) {
    cin >> aaa[x];
    if (aaa[x] >= 1000000007) {
      aaa[x] = aaa[x] % 1000000007;
    }
  }
  int64_t sum = 0;
  for (int y = 0; y < n - 1; y++) {
    for (int z = y + 1; z < n; z++) {
      sum = sum + (aaa[y] ^ aaa[z]);
    }
  }
  cout << sum % 1000000007 << endl;
  return 0;
}
