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