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