#include <bits/stdc++.h>
using namespace std;
int main() {
  int64_t N, A, sum = 0;
  cin >> N;
  vector<int64_t> array(N);
  for (int i = 0; i < N; i++) {
    cin >> array[i];
    for (int j = 0; j < i; j++) {
      sum += array[i] ^ array[j];
      sum %= 1000000007;
    }
  }
  cout << sum << endl;
}
