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