#include <bits/stdc++.h>
#pragma target("avx")
using ll = int_fast64_t;
using P = std::pair<ll, ll>;
using V = std::vector<ll>;
template <typename T>
using pq = std::priority_queue<T>;
template <typename T>
using rpq = std::priority_queue<T, std::vector<T>, std::greater<T>>;
const int MOD = 1e9 + 7;
const ll INF = 1e18;
int dx[] = {0, 1, 0, -1, 1, 1, -1, -1}, dy[] = {1, 0, -1, 0, 1, -1, -1, 1};
int main() {
  ll n, zero, one;
  scanf("%ld", &n);
  V a(n);
  for (auto &i : a) scanf("%ld", &i);
  ll w = 1, ans = 0;
  for (ll i = 0; i < 61; i++) {
    zero = one = 0;
    for (ll &x : a) {
      if ((x >> i) & 1)
        one++;
      else
        zero++;
    }
    ans = (ans + w * zero * one % MOD) % MOD;
    w = w * 2 % MOD;
  }
  printf("%ld\n", ans);
  return 0;
}
