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