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