#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++) {
    long long int temp = pre[i] * ((n - pre[i]) % md) % md;
    while (temp < 0) temp += md;
    temp *= (1ll << i);
    temp %= md;
    sum += temp;
    sum %= md;
  }
  cout << sum;
}
