#include <iostream>
#define int long long
using namespace std;
int n,x;
int c[63];
const int mod = 1e9+7;
signed main() {
    cin >> n;
    for( int i = 0 ; i < n ; i++ ) {
    	cin >> x;
        for( int j = 0 ; j <= 60 ; j++ ) if( x & (1ll << j) ) c[j]++;
    }    
    long long res = 0;
    for( int i = 0 ; i <= 60 ; i++ ) {
        res = (res+(long long)( n - c[i])%mod* c[i]%mod * (( 1ll << i )%mod)%mod);
	}
    cout << res%mod << endl;
    return 0;
}