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