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