#include <bits/stdc++.h>
using namespace std;
int main() {
  unsigned int n, i, j;
  unsigned long long int a[300000], s = 0, k;
  const unsigned int m = 1000000007;
  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++) {
      s += (a[i] ^ a[j]);
      s = s % m;
    }
  }
  cout << s;
  return 0;
}
