#include <bits/stdc++.h>
using namespace std;
long long int dizi[3000007];
long long int pre[65];
const long long int md = 1000000007;
int main() {
  long long int n;
  cin >> n;
  for (long long int mi = 1; mi <= n; mi++) {
    cin >> dizi[mi];
    for (long long int i = 0; i < 64; i++) {
      if ((dizi[mi] & (long long)1 << i) != 0) pre[i]++;
      pre[i] %= md;
    }
  }
  long long int sum = 0;
  for (long long int i = 0; i < 64; i++) {
    sum +=
        (((pre[i]) * (n - pre[i]) + md) % md * (((long long)1 << i) + md) % md +
         md) %
        md;
    sum += md;
    sum %= md;
  }
  cout << sum;
}
