#include <bits/stdc++.h>
long long mod = 1000000007;
using namespace std;
int main(void) {
  long long N, ans = 0;
  cin >> N;
  long long A[N];
  for (long long i = 0; i < N; ++i) {
    scanf("%lld", &A[i]);
  }
  for (long long i = 0; i < N; ++i) {
    for (long long j = i + 1; j < N; ++j) {
      ans = (ans + (A[i] ^ A[j])) % mod;
    }
  }
  ans %= mod;
  cout << ans << endl;
}
