#include <bits/stdc++.h>
using namespace std;
using ll = long long;
template <typename T>
using V = std::vector<T>;
using Vi = V<int>;
using VVi = V<V<int>>;
using Vl = V<ll>;
using VVl = V<V<ll>>;
using Vs = V<string>;
template <typename T1, typename T2>
using P = std::pair<T1, T2>;
using Pii = P<int, int>;
using Pll = P<ll, ll>;
using Pdd = P<double, double>;
template <typename T1, typename T2>
using M = std::map<T1, T2>;
using Mii = M<int, int>;
using Msi = M<string, int>;
const double PI = acos(-1);
const ll MOD = 1e9 + 7;
int main() {
  int n;
  cin >> n;
  Vl v(n);
  for (int i = 0; i < (int)(n); ++i) {
    cin >> v[i];
  }
  ll res = 0;
  for (int i = 0; i < (int)(60); ++i) {
    ll c0 = 0;
    ll c1 = 0;
    for (int j = 0; j < (int)(n); ++j) {
      if (v[j] & (1LL << i)) {
        c1++;
      } else {
        c0++;
      }
    }
    res += ((ll)pow(2LL, (ll)i) % MOD * (c0 * c1) % MOD) % MOD;
    res %= MOD;
  }
  std::cout << res << '\n';
  return 0;
}
