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