#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using P = pair<ll, ll>;
const ll MOD = 1000000007;
int main() {
  ll n;
  cin >> n;
  vector<ll> a(n);
  for (ll i = 0; i < (ll)n; ++i) cin >> a.at(i);
  ll ans = 0;
  for (ll i = 0; i < n - 1; ++i) {
    for (ll j = i + 1; j < n; ++j) {
      ans += a.at(i) ^ a.at(j);
      ans %= MOD;
    }
  }
  cout << ans << endl;
  return 0;
}
