#include <bits/stdc++.h>
using namespace std;
const long long SZ = 5e5 + 4;
const double EPS = 1e-7;
const long long mod = 1e9 + 7;
const long long inf = 1e9;
struct custom_hash {
  size_t operator()(uint64_t x) const {
    static const uint64_t FIXED_RANDOM =
        chrono::steady_clock::now().time_since_epoch().count();
    return x + FIXED_RANDOM;
  }
};
long long n;
long long a[SZ];
void read() {
  cin >> n;
  for (long long i = 0; i < n; ++i) {
    cin >> a[i];
  }
}
void solve() {
  long long ans = 0;
  for (long long i = 0; i < n; ++i) {
    for (long long j = i + 1; j < n; ++j) {
      ans += a[i] ^ a[j];
      ans %= mod;
    }
  }
  cout << ans;
}
signed main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  read();
  solve();
  return 0;
}
