#include <bits/stdc++.h>
using namespace std;
long long mod = 1e9 + 7;
long long power(long long num, long long g, long long mod) {
  if (g == 0) return 1;
  if (g % 2 == 1) return (num * power((num * num) % mod, g / 2, mod)) % mod;
  return power((num * num) % mod, g / 2, mod);
}
long long int sumXOR(long long *arr, int n) {
  long long int sum = 0;
  for (int i = 0; i <= 62; 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;
    }
    long long c = 1;
    for (int j = 0; j < i; j++) c *= 2;
    idsum = oc * c;
    idsum %= mod;
    idsum *= zc;
    idsum %= mod;
    sum += idsum;
    sum %= mod;
  }
  return sum % mod;
}
int main() {
  int n;
  cin >> n;
  long long a[n];
  for (int i = 0; i < n; i++) cin >> a[i];
  cout << sumXOR(a, n);
}
