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