#include <bits/stdc++.h>
int main(int argc, char const *argv[]) {
  int N;
  unsigned long int A[300000];
  int mod = 1000000007;
  unsigned long int sum = 0;
  scanf("%d", &N);
  for (int k = 0; k < N; k++) {
    scanf("%ld", (A + k));
  }
  for (int i = 1; i <= N - 1; i++) {
    for (int j = i + 1; j <= N; j++) {
      sum += (A[i - 1] ^ A[j - 1]);
    }
  }
  printf("%ld\n", sum % mod);
  return 0;
}
