#include <iostream>

using namespace std;

#define rep(i,n) for(int i=0; i<(int)(n); i++)

typedef long long ll;

const ll mod = (ll)(1e9+7);

int main() {
  ll n;
  cin >> n;
  ll a[n];
  rep(i,n) cin >> a[i];
  
  ll r = 0;
  rep(k,60) {
    ll m = 0;
    rep(i,n) m += (a[i]>>k) % 2;
    r = (r + (n - m) * m % mod * ((1L<<k) % mod)) % mod;
  }
  cout << r << endl;
  return 0;
}