#include <bits/stdc++.h>
using namespace std;
long long n, k, a[300005], b[67][2], ans, i, raod, j;
int main() {
  cin >> n;
  for (k = 1; k <= n; k++) cin >> a[k];
  for (i = 1; i <= n; i++) {
    raod = 0;
    while (a[i]) {
      raod++;
      b[raod][a[i] % 2]++;
      a[i] = a[i] / 2;
    }
    for (j = raod + 1; j <= 60; j++) b[j][0]++;
  }
  j = 1;
  for (k = 1; k <= 60; k++) {
    ans += b[k][1] * b[k][0] * j;
    j *= 2;
  }
  cout << ans % (1000000007) << endl;
}
