#include <bits/stdc++.h>
using namespace std;
long long powmod(long long px, long long py, long long pmod) {
  if (py == 0) return 1;
  if (py % 2 == 0)
    return powmod((px * px) % pmod, py / 2, pmod);
  else
    return (px * powmod(px, py - 1, pmod)) % pmod;
}
const long long mod = 1e9 + 7;
int main() {
  long long n, i, j, a[300005], b[300005][70], ans = 0;
  cin >> n;
  for (i = 0; i < n; i++) {
    cin >> a[i];
    j = 0;
    while (a[i] > 0) {
      b[i][j] = a[i] % 2;
      a[i] = (a[i] - a[i] % 2) / 2;
      j++;
    }
  }
  for (j = 0; j <= 60; j++) {
    long long aa = 0, bb = 0;
    for (i = 0; i < n; i++) {
      if (b[i][j] == 1)
        aa++;
      else
        bb++;
    }
    aa = aa * bb;
    ans = (ans + powmod(2, j, mod) * aa % mod) % mod;
  }
  cout << ans << endl;
  return 0;
}
