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