#include <bits/stdc++.h>
using namespace std;
const int MOD = 1e9 + 7;
int N;
unsigned long long ans;
unsigned long long arr[300002];
int main() {
  scanf("%d", &N);
  for (int i = 0; i < N; i++) scanf("%lld", &arr[i]);
  for (int i = 0; i < 62; i++) {
    unsigned long long o = 0, z = 0;
    for (int j = 0; j < N; j++) {
      if ((arr[j] % 2LL) == 0)
        z++;
      else
        o++;
      arr[j] /= 2LL;
    }
    unsigned long long cur = (((o * z) % MOD) * (1LL << i) % MOD) % MOD;
    ans = (ans + cur) % MOD;
  }
  printf("%lld\n", ans);
  return 0;
}
