#include <bits/stdc++.h>
using namespace std;
int main() {
  const long long mod = 1000000007;
  int N;
  cin >> N;
  vector<long long> A(N);
  auto* const a = &A[0];
  for (int i = 0; i < N; ++i) cin >> a[i];
  long long sum = 0;
  for (int i = 0; i < N - 1; ++i)
    for (int j = i + 1; j < N; ++j) sum = (sum + (a[i] ^ a[j])) % mod;
  cout << sum;
  return 0;
}
