#include <bits/stdc++.h>
using namespace std;
const int maxx = 1e5 + 7;
const int Inf = 1 << 30;
const long long INF = 1ll << 60;
const int Mod = 1e9 + 7;
int n;
long long a[3 * maxx];
long long ans;
int main() {
  scanf("%d", &n);
  for (int i = 1; i <= n; i++) scanf("%lld", &a[i]);
  for (long long i = 1; i < n; i++) {
    for (long long j = i + 1; j <= n; j++) {
      ans += a[i] ^ a[j];
      ans %= Mod;
    }
  }
  printf("%lld\n", ans % Mod);
  return 0;
}
