#include <bits/stdc++.h>
using namespace std;
inline long long Read(void) {
  long long sum = 0;
  int sign = 1;
  char ch = getchar();
  while (ch > '9' || ch < '0') {
    if (ch == '-') {
      sign = -1;
    }
    ch = getchar();
  }
  while (ch >= '0' && ch <= '9') {
    sum = sum * 10 + ch - '0';
    ch = getchar();
  }
  return sum * sign;
}
long long a[300010];
int main() {
  int n, i, j;
  long long sum = 0;
  scanf("%d", &n);
  for (i = 0; i < n; i++) {
    a[i] = Read();
  }
  for (i = 0; i < n - 1; i++) {
    for (j = i + 1; j < n; j++) {
      sum += (a[i] ^ a[j]) % 1000000007;
      sum %= 1000000007;
    }
  }
  printf("%lld\n", sum);
}
