#include <bits/stdc++.h>
long long a[300010];
int main() {
  int n, i, j;
  scanf("%d", &n);
  for (i = 1; i <= n; i++) scanf("%lld", &a[i]);
  long long sum = 0;
  for (i = 1; i <= n - 1; i++)
    for (j = i + 1; j <= n; j++) {
      sum += a[i] ^ a[j];
      sum %= (long long)1e9 + 7;
    }
  printf("%lld\n", sum);
}
