#include <bits/stdc++.h>
using namespace std;
long long power(long long x, long long y, long long p) {
  long long res = 1;
  x = x % p;
  while (y > 0) {
    if (y & 1) res = (res * x) % p;
    y = y >> 1;
    x = (x * x) % p;
  }
  return res;
}
long long int sumXOR(long long int arr[], int n) {
  long long int sum = 0;
  for (int i = 0; i < 128; i++) {
    int zc = 0, oc = 0;
    long long int idsum = 0;
    for (int j = 0; j < n; j++) {
      if (arr[j] % 2 == 0)
        zc++;
      else
        oc++;
      arr[j] /= 2;
    }
    idsum = (oc % 1000000007 * zc % 1000000007 * (power(2, i, 1000000007)) %
             1000000007) %
            1000000007;
    sum = (sum % 1000000007 + idsum % 1000000007) % 1000000007;
  }
  return sum;
}
int main() {
  long long int sum = 0, n;
  cin >> n;
  long long a[n], i;
  for (i = 0; i < n; i++) cin >> a[i];
  sum = sumXOR(a, n);
  cout << sum % 1000000007;
  return 0;
}
