#include <bits/stdc++.h>
int main() {
  int n;
  scanf("%d", &n);
  int ar[n];
  for (int p = 0; p < n; ++p) {
    scanf("%d", &ar[p]);
  }
  int mod = 1e9 + 7;
  int sum = 0;
  for (int i = 0; i < n; ++i) {
    for (int j = i; j < n; ++j) sum += (ar[i] ^ ar[j]) % mod;
  }
  printf("%d", sum);
  return 0;
}
