#include <bits/stdc++.h>
using namespace std;
using ll = long long;
ll MOD = 1000000007;
ll N, A[300010];
int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  cin >> N;
  for (int i = 0; i < N; ++i) {
    cin >> A[i];
  }
  ll ans = 0;
  for (int d = 0; d < 60; ++d) {
    ll v0 = 0, v1 = 0;
    for (int i = 0; i < N; ++i) (((A[i] >> d) & 1) == 0 ? v0 : v1)++;
    ll a = v0 * v1 % MOD;
    for (int i = 0; i < d; ++i) a = a * 2 % MOD;
    ans = (ans + a) % MOD;
  }
  cout << ans << endl;
  return 0;
}
