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