#include <bits/stdc++.h>
using namespace std;
const int MOD = 1000000007;
void solve() {
  int N;
  cin >> N;
  vector<long long> A(N);
  for (int i = 0; i < (N); ++i) cin >> A[i];
  long long ans = 0;
  long long tmp = 0;
  for (int i = 0; i < N; ++i) {
    for (int j = i + 1; j < N; ++j) {
      tmp += A[i] ^ A[j];
      tmp %= MOD;
    }
  }
  cout << tmp << '\n';
}
int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  solve();
  return 0;
}
