#include <bits/stdc++.h>
using namespace std;
using ll = long long;
ll A[300100];
ll MOD = 1e9 + 7;
int main() {
  int N;
  cin >> N;
  for (int i = 1; i <= N; ++i) {
    cin >> A[i];
  }
  ll total = 0;
  for (int i = 1; i < N; ++i) {
    for (int j = i + 1; j <= N; ++j) {
      total += (A[i] ^ A[j]) % MOD;
      total %= MOD;
    }
  }
  cout << total << endl;
  return 0;
}
