#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const int INF = 1001001001;
const ll MX = (ll)1e9 + 7;
int main() {
  int n;
  cin >> n;
  vector<ll> a(n);
  for (int i = 0; i < (n); ++i) cin >> a.at(i);
  ll ans = 0;
  for (int i = 0; i < n - 1; i++) {
    for (int j = i + 1; j < n; j++) {
      ll t = (a.at(i)) ^ (a.at(j));
      t %= MX;
      ans = (ans + t) % MX;
    }
  }
  cout << ans << endl;
}
