#include <bits/stdc++.h>
int main() {
  long long int n, i, j;
  scanf("%lld", &n);
  unsigned long long int a[n];
  long long int temp = 0, x;
  for (i = 0; i < n; i++) {
    scanf("%llu", &a[i]);
    for (j = i - 1; j >= 0; j--) temp += a[i] ^ a[j];
  }
  x = pow(10, 9) + 7;
  printf("%lld", temp % (x));
  return 0;
}
