#include <bits/stdc++.h>
using namespace std;
long long const m = 1000000007;
long long power(long long a, long long n, long long m) {
  if (n == 0)
    return 1;
  else if (n == 1)
    return a % m;
  else {
    long long res = power(a, n / 2, m);
    if (n % 2 == 0)
      return ((res) * (res)) % m;
    else
      return ((res) * (res) * (a)) % m;
  }
}
int main() {
  long long n, i, j, k, count = 0;
  cin >> n;
  long long arr[n];
  for (i = 0; i < n; i++) cin >> arr[i];
  for (i = 0; i < n - 1; i++) {
    for (j = i + 1; j < n; j++) {
      long long temp1 = arr[i], temp2 = arr[j];
      k = 0;
      while (temp1 > 0 || temp2 > 0) {
        if (temp1 % 2 != temp2 % 2) count = count + (long long)(power(2, k, m));
        temp1 /= 2, temp2 /= 2;
        k++;
      }
    }
  }
  cout << count % m << endl;
  return 0;
}
