#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  scanf("%d", &n);
  vector<long long> a(n);
  for (int i = 0; i < n; i++) {
    long long v;
    scanf("%lld", &v);
    a[i] = v;
  }
  long long sum = 0;
  for (int i = 0; i < n - 1; ++i) {
    for (int j = i + 1; j < n; ++j) {
      sum = (sum + (a[i] ^ a[j])) % (1000000000 + 7);
    }
  }
  cout << sum << endl;
  return 0;
}
