#include <bits/stdc++.h>
const static unsigned MOD = 1000000007;
using ull = unsigned long long;
int main() {
  ull N;
  scanf("%llu", &N);
  ull n_1[60];
  for (int i = 0; i < 60; ++i) {
    n_1[i] = 0;
  }
  for (int i = 0; i < N; ++i) {
    ull a;
    scanf("%llu", &a);
    for (unsigned j = 0; j < 60; ++j) {
      if (a >> j & 1) n_1[j]++;
    }
  }
  ull ans = 0;
  for (unsigned i = 0; i < 60; ++i) {
    ans = (ans + (1 << i) % MOD * n_1[i] % MOD * (N - n_1[i]) % MOD) % MOD;
  }
  printf("%llu\n", ans);
  return 0;
}
