#include <bits/stdc++.h>
using namespace std;
long long ar[70];
int main() {
  long long n, i, j, c, d, an = 0, k, mod;
  mod = 1000000007;
  cin >> n;
  long long num;
  for (i = 0; i < n; i++) {
    cin >> num;
    for (j = 0; j < 60; j++) {
      k = 1LL << j;
      c = 0;
      d = 0;
      if ((num & k)) ar[j]++;
    }
  }
  for (i = 0; i < 60; i++) {
    k = 1LL << i;
    an = (an + ((k % mod) * (ar[i] % mod) * ((n - ar[i]) % mod)) % mod) % mod;
  }
  cout << an << endl;
}
