#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using pint = pair<int, int>;
using pll = pair<ll, ll>;
template <typename T>
auto compare = [](T x, T y) -> bool { return (x < y); };
const int MOD = 1000000007;
ll N;
map<int, int> mp;
ll pow2[61];
signed main() {
  cin >> N;
  unsigned long long a;
  for (int(i) = 0; (i) < (N); ++(i)) {
    cin >> a;
    for (int(j) = 0; (j) < (61); ++(j)) {
      if (a == 0) continue;
      if (a % 2 == 1) mp[j]++;
      a /= 2;
    }
  }
  pow2[0] = 1;
  for (int(i) = 0; (i) < (60); ++(i)) pow2[i + 1] = (pow2[i] * 2) % MOD;
  ll ans = 0;
  for (int(i) = 0; (i) < (60); ++(i)) {
    ll k = mp[i] * (N - mp[i]);
    ans = (ans + k * pow2[i] % MOD) % MOD;
  }
  cout << (ans) << "\n";
  return 0;
}
