#include <bits/stdc++.h>
int main() {
  int n, i, j;
  long *a;
  long count = 0;
  scanf("%d", &n);
  a = (long *)malloc(sizeof(long) * n);
  for (i = 0; i < n; i++) {
    scanf("%ld", &a[i]);
  }
  for (i = 0; i < n - 1; i++) {
    for (j = i + 1; j < n; j++) {
      count += a[i] ^ a[j];
    }
  }
  printf("%ld", count % 1000000007);
  free(a);
}
