#include <bits/stdc++.h>
const double PI =
    3.141592653589793238462643383279502884197169399375105820974944;
using namespace std;
void solve() {
  int N;
  cin >> N;
  vector<long long> A(N);
  for (int i = 0; i < N; i++) cin >> A[i];
  const int mod = 1000000007;
  long long ans = 0;
  for (int i = 0; i < N - 1; ++i) {
    for (int j = i + 1; j < N; ++j) {
      ans += (A[i] ^ A[j]) % mod;
    }
  }
  cout << ans % mod << endl;
}
signed main() { solve(); }
