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