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