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