#include <bits/stdc++.h>
using namespace std;
int main() {
  long long n, a[70], ans;
  unsigned long long ipt;
  bitset<60> bt;
  ans = 0;
  memset(a, 0, sizeof(a));
  cin >> n;
  for (int i = 0; i < n; i++) {
    cin >> ipt;
    bt = ipt;
    for (int j = 0; j < 60; j++) a[j] += bt[j];
  }
  long long k = 1;
  for (int i = 0; i < 60; i++) {
    ans += (n - a[i]) * a[i] * k;
    ans %= 1000000007;
    k <<= 1;
  }
  cout << ans << endl;
}
