#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  cin >> n;
  unsigned long long a[n];
  for (int i = 0; i < n; i++) {
    cin >> a[i];
  }
  unsigned long long sum = 0;
  int m = pow(10, 9) + 7;
  for (int i = 0; i < n - 1; i++) {
    for (int j = i + 1; j < n; j++) {
      sum = sum + (a[i] ^ a[j]);
    }
  }
  cout << sum % m;
}
