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