#include <bits/stdc++.h>
using namespace std;
unsigned long long int ones[70];
unsigned long long int zeros[70];
int main() {
  int n;
  cin >> n;
  while (n--) {
    unsigned long long int x;
    cin >> x;
    for (int i = 0; i < 63; i++) {
      if (x % 2) {
        ones[i]++;
      } else {
        zeros[i]++;
      }
      x /= 2;
    }
  }
  unsigned long long int sum = 0, mod = 1000000007;
  unsigned long long int mul[64] = {1};
  for (int i = 1; i < 64; i++) {
    mul[i] = (mul[i - 1] << 1) % mod;
  }
  for (int i = 0; i < 63; i++) {
    unsigned long long int x = (zeros[i] * ones[i] * mul[i]) % mod;
    sum = (sum + x) % mod;
  }
  cout << sum << endl;
  return 0;
}
