#include <bits/stdc++.h>
using namespace std;
long long gcd(long long a, long long b) {
  if (b == 0) {
    return a;
  }
  return gcd(b, a % b);
}
long long lcm(long long a, long long b) { return (a * b) / gcd(a, b); }
long long f(long long x) {
  long long res = 0;
  while (x % 2 == 0) {
    x /= 2;
    res++;
  }
  return res;
}
long long arr[300001];
int32_t main() {
  long long n;
  cin >> n;
  for (long long i = 0; i < n; i++) {
    long long tmp;
    cin >> tmp;
    arr[i] = tmp;
  }
  long long sum = 0;
  for (long long i = 0; i < n; i++) {
    for (long long j = i + 1; j < n; j++) {
      sum += arr[i] ^ arr[j];
    }
  }
  sum %= 1000000007;
  ;
  cout << sum << endl;
}
