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