#include <bits/stdc++.h>
using namespace std;
const long long mod = 1e9 + 7;
const long long maxn = 3e5 + 5;
long long arr[maxn];
long long sumXOR(long long arr[], long long n) {
  long long sum = 0;
  for (long long i = 0; i < 60ll; i++) {
    long long zc = 0ll, oc = 0ll;
    long long idsum = 0;
    for (long long j = 0; j < n; j++) {
      if (arr[j] % 2 == 0)
        zc++;
      else
        oc++;
      arr[j] /= 2;
    }
    idsum = (oc % mod) * zc % mod * (1ll << i) % mod;
    sum = (sum + idsum) % mod;
  }
  return sum;
}
signed main() {
  long long sum = 0;
  long long n;
  scanf("%lld", &n);
  for (long long i = 0; i < n; ++i) scanf("%lld", &arr[i]);
  sum = sumXOR(arr, n);
  cout << (sum + mod) % mod;
  return 0;
}
