#include <bits/stdc++.h>
using namespace std;
template <class T>
bool chmax(T &a, const T &b) {
  if (a < b) {
    a = b;
    return true;
  }
  return false;
}
template <class T>
bool chmin(T &a, const T &b) {
  if (a > b) {
    a = b;
    return true;
  }
  return false;
}
const long long mod = 1e9 + 7;
const long long INF = mod;
const int MAX = 100010;
int main() {
  int n;
  scanf("%d", &n);
  long long a[n];
  for (int((i)) = (0); ((i)) < ((n)); ++((i))) scanf("%lld", &a[i]);
  long long cnt[62][2];
  for (int((i)) = (0); ((i)) < ((62)); ++((i)))
    for (int((j)) = (0); ((j)) < ((2)); ++((j))) cnt[i][j] = 0;
  for (int((i)) = (0); ((i)) < ((n)); ++((i)))
    for (int((j)) = (0); ((j)) < ((62)); ++((j))) {
      ++cnt[j][(a[i] >> j) & 1];
    }
  long long ans = 0;
  for (int((i)) = (0); ((i)) < ((62)); ++((i))) {
    (ans += cnt[i][0] * cnt[i][1] % mod * (1LL << i) % mod) %= mod;
  }
  printf("%lld\n", ans);
}
