#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using pii = pair<int, int>;
const int MOD = 1000000007;
ll cnt[60][2];
signed main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  int N;
  cin >> N;
  for (int i = (0); i < (N); i++) {
    uint64_t v;
    cin >> v;
    for (int bi = (0); bi < (61); bi++) cnt[bi][(bool)(v & (1ull << bi))]++;
  }
  ll cur = 1, ans = 0;
  for (int bi = (0); bi < (61); bi++) {
    ans = (ans + cnt[bi][0] * cnt[bi][1] * cur) % MOD;
    cur = cur * 2 % MOD;
  }
  cout << ans << endl;
}
