#include <bits/stdc++.h>
int n;
int64_t a[300001];
int main() {
  scanf("%d", &n);
  for (int i = 0; i < n; i++) {
    scanf("%lld", &(a[i]));
  }
  long long int sum = 0;
  for (int i = 0; i < n - 1; i++) {
    for (int j = i + 1; j < n; j++) {
      sum = (sum + (a[i] ^ a[j])) % 1000000007;
    }
  }
  printf("%lld\n", sum);
  return 0;
}
