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