#include <bits/stdc++.h>
using namespace std;
const int maxn = 3e5 + 5;
const int mod = 1e9 + 7;
long long a[maxn];
int main() {
  int n;
  cin >> n;
  long long sum = 0;
  for (int i = 0; i < n; i++) scanf("%lld", &a[i]);
  for (int i = 0; i < 60; i++) {
    int cnd = 0;
    for (int j = 0; j < n; j++) {
      if ((a[j] >> i) & 1) cnd++;
    }
    sum += (cnd % mod) * ((n - cnd) % mod) * (1ll << i) % mod;
    sum %= mod;
  }
  cout << sum;
  return 0;
}
