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