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