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