#include <bits/stdc++.h>
using namespace std;
const long long MOD = 1000000007;
int main() {
  ios::sync_with_stdio(false);
  cin.tie(nullptr);
  int n;
  cin >> n;
  vector<long long> a(n);
  for (int i = 0; i < n; i++) cin >> a[i];
  long long sum = 0;
  for (int i = 0; i < 60; i++) {
    long long zc = 0, oc = 0;
    long long idsum = 0;
    for (int j = 0; j < n; j++) {
      if (a[j] % 2 == 0) {
        zc++;
        zc = zc % MOD;
      } else {
        oc++;
        oc = oc % MOD;
      }
      a[j] /= 2;
    }
    idsum = zc * oc % MOD * (1 << i) % MOD;
    sum += idsum;
    sum = (sum % MOD);
  }
  cout << sum << '\n';
  return 0;
}
