#include <bits/stdc++.h>
using namespace std;
using i64 = long long;
i64 mod = 1000000007LL;
int main() {
  int n;
  cin >> n;
  vector<i64> a(n);
  for (auto &&ai : a) cin >> ai;
  i64 sum = 0;
  for (int d = 0; d < 60; d++) {
    int k = 0;
    for (auto &&ai : a)
      if (ai & (1LL << d)) k++;
    i64 _sum = k * (n - k);
    _sum *= (i64)pow(2, d) % mod;
    sum += _sum;
    sum %= mod;
  }
  cout << sum << endl;
  return 0;
}
