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