#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  cin >> n;
  unsigned long int* a;
  a = (unsigned long int*)malloc(n * sizeof(unsigned long int));
  for (int i = 0; i < n; i++) {
    scanf("%lld", &a[i]);
  }
  unsigned long sum = 0;
  for (int i = 0; i < n - 1; i++) {
    for (int j = i + 1; j < n; j++) {
      sum += a[i] ^ a[j];
    }
  }
  printf("%lld\n", sum % 1000000007);
}
