#include <bits/stdc++.h>
using namespace std;
const int mod = 1000000007;
int main(void) {
  int n;
  cin >> n;
  vector<long long> a(n);
  for (int i = 0; i < (n); i++) cin >> a[i];
  long long ans = 0;
  for (int i = 0; i < (64); i++) {
    long long cnt = 0;
    for (int j = 0; j < (n); j++) {
      if ((a[j] & 1) == 0) cnt++;
      a[j] >>= 1;
    }
    long long p = (1LL << i) % mod;
    long long d = cnt * (n - cnt) * p % mod;
    ans = (ans + d) % mod;
  }
  cout << ans << endl;
  return 0;
}
