#include <bits/stdc++.h>
using namespace std;
int dx[4] = {1, 0, -1, 0}, dy[4] = {0, 1, 0, -1};
const int MOD = 1000000007;
const long double PI = (acos(-1));
const int MAX = 1000001;
long long fac[MAX], finv[MAX], inv[MAX];
void COMinit() {
  fac[0] = fac[1] = 1;
  finv[0] = finv[1] = 1;
  inv[1] = 1;
  for (int i = 2; i < MAX; i++) {
    fac[i] = fac[i - 1] * i % MOD;
    inv[i] = MOD - inv[MOD % i] * (MOD / i) % MOD;
    finv[i] = finv[i - 1] * inv[i] % MOD;
  }
}
int n;
long long a[300001];
void Input() {
  cin >> n;
  for (int i = 0; i < n; i++) {
    cin >> a[i];
  }
}
void Solve() {
  long long ans = 0;
  for (int i = 0; i < n - 1; i++) {
    long long ai = a[i] % MOD;
    for (int j = i + 1; j < n; j++) {
      ans += (ai ^ a[j]) % MOD;
    }
  }
  cout << ans % MOD << '\n';
}
int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  Input();
  Solve();
  return 0;
}
