#include <bits/stdc++.h>
using namespace std;
int main(void) {
  long sum = 0;
  int N;
  scanf("%d", &N);
  vector<long> v;
  for (int i = 0; i < N; i++) {
    long k;
    scanf("%ld", &k);
    v.push_back(k);
  }
  for (int i = 0; i < N - 1; i++) {
    for (int j = i + 1; j < N; j++) {
      sum += v[i] ^ v[j];
    }
  }
  printf("%ld", sum % (10 * 10 * 10 * 10 * 10 * 10 * 10 * 10 * 10 + 7));
  return 0;
}
