#include <bits/stdc++.h>
int main(void) {
  long a, b = 1000000007, c[300000], sum;
  scanf("%ld", &a);
  for (int i = 0; i < a; i++) {
    scanf("%ld", &c[i]);
  }
  for (int i = 0; i < a; i++) {
    for (int j = i + 1; j < a; j++) {
      sum += c[i] ^ c[j];
    }
  }
  sum %= b;
  printf("%ld\n", sum);
}
