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