#include <bits/stdc++.h>
using namespace std;
const unsigned long long MOD = 1000000007;
unsigned long long BITS[64];
int main() {
  int n;
  scanf("%d", &n);
  int one[64];
  memset(one, 0, sizeof(one));
  unsigned long long ONE = 1ll;
  for (int i = 0; i <= 60; i++) {
    BITS[i] = (ONE << i);
  }
  for (int i = 0; i < n; i++) {
    unsigned long long v;
    scanf("%lld", &v);
    for (int j = 0; j <= 60; j++) {
      if (v & (BITS[j])) {
        one[j]++;
      }
    }
  }
  unsigned long long ans = 0;
  for (int i = 0; i <= 60; i++) {
    unsigned long long x = one[i] * (n - one[i]) % MOD;
    ans = (ans + x * (BITS[i] % MOD)) % MOD;
  }
  cout << ans << endl;
}
