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