#include <bits/stdc++.h>
using namespace std;
long long int dizi[300007];
long long int pre[61];
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 < 60; i++) {
      if (dizi[mi] & (((long long)1 << i))) pre[i]++;
    }
  }
  long long int sum = 0;
  for (long long int i = 0; i < 60; i++) {
    sum += (((pre[i]) * (n - pre[i])) % md * (((long long)1 << i)) % md) % md;
    sum += md;
    sum %= md;
  }
  cout << sum;
}
