#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using P = pair<int, int>;
ll mod = 1e9 + 7;
int main() {
  int n;
  cin >> n;
  vector<ll> a(n);
  for (int 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 v1 = a[i];
      ll v2 = a[j];
      ans += (v1 ^ v2);
      ans %= mod;
    }
  }
  cout << ans << endl;
  return 0;
}
