#include <bits/stdc++.h>
int MOD = pow(10, 9) + 7;
using namespace std;
using ll = long long;
int main(int argc, char **argv) {
  int n;
  cin >> n;
  vector<ll> vec(n);
  for (int i = 0; i < n; i++) {
    cin >> vec[i];
  }
  ll ans = 0;
  ll a, b;
  for (int i = 0; i < n - 1; i++) {
    a = vec[i];
    for (int j = i; j < n; j++) {
      b = vec[j];
      ans = (ans + (a ^ b) % MOD) % MOD;
    }
  }
  cout << ans << endl;
  return 0;
}
