#include <bits/stdc++.h>
using namespace std;
using ll = unsigned long long;

const ll MOD = 1'000'000'007;
const int LEN = 60;

int main() {
  int n;
  cin >> n;

  vector<bitset<LEN>> a;
  for (int i = 0; i < n; ++i) {
    ll x;
    cin >> x;
    a.emplace_back(x);
  }

  vector<int> c(LEN);
  for (int i = 0; i < n; ++i) {
    for (int j = 0; j < LEN; ++j) {
      c[j] += a[i][j];
    }
  }

  auto f = [&](int i) {
    ll res = c[i] * (n - c[i]) % MOD;
    for (int j = 0; j < i; ++j) {
      res *= 2;
      res %= MOD;
    }
    return res;
  };

  ll ans = 0;
  for (int i = 0; i < LEN; ++i) {
    ans += f(i);
    ans %= MOD;
  }
  cout << ans << endl;
}