#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const ll MOD = 1000000007;
int main() {
  ll n;
  cin >> n;
  vector<ll> a(n);
  for (int i = 0; i < n; i++) {
    cin >> a[i];
  }
  vector<ll> bits(61, 0);
  for (int i = 0; i < 60; i++) {
    ll s0 = 0LL, s1 = 0LL;
    for (int j = 0; j < n; j++) {
      (a[j] & (1LL << i)) ? s1++ : s0++;
    }
    bits[i] = s1 * s0 % MOD;
  }
  ll sum = 0LL;
  for (int i = 0; i < 60; i++) {
    sum = (sum + (bits[i] * (1LL << i) % MOD) % MOD) % MOD;
  }
  cout << sum << endl;
}
