#include <bits/stdc++.h>
using namespace std;
const int N = 1e6 + 5, M = 1e3 + 7, mod = 1e9 + 7;
int dx[] = {0, 1, -1, 0}, dy[] = {1, 0, 0, -1};
int b[N], n, m, k, tc, ans, d, x, y;
long long a[N];
char s[N];
vector<pair<int, int> > g[N];
long long solve() {
  long long ret = 0;
  for (int i = 0; i < 60; i++) {
    int z = 0, o = 0;
    long long curr = 0;
    for (int j = 0; j < n; j++) {
      if (a[j] % 2 == 0)
        z++;
      else
        o++;
      a[j] /= 2;
    }
    curr = ((o * z) % mod * (1LL << i) % mod) % mod;
    ret = (ret + curr) % mod;
  }
  return ret;
}
int main() {
  scanf("%d", &n);
  for (int i = 0; i < n; i++) scanf("%lld", &a[i]);
  printf("%lld\n", solve());
}
