#include<bits/stdc++.h>
typedef long long int ll;
using namespace std;
#define MOD (ll)1000000007
ll arr[1000000];
int main(){
ll n;
cin >> n;
for(ll i = 0; i < n; i++){
cin >> arr[i];
}
ll sum = 0;
for(ll i = 0; i < 60; i++){
ll oc = 0, zc = 0;
for(ll j = 0; j < n; j++){
if(arr[j]%2 == 0){
zc++;
}
else{
oc++;
}
arr[j] /= 2;
}
sum = (sum + (zc*oc*((ll)1<<i)%MOD)%MOD)%MOD;
}
cout << sum;
}
I2luY2x1ZGU8Yml0cy9zdGRjKysuaD4KCnR5cGVkZWYgbG9uZyBsb25nIGludCBsbDsKCnVzaW5nIG5hbWVzcGFjZSBzdGQ7CgojZGVmaW5lIE1PRCAobGwpMTAwMDAwMDAwNwoKbGwgYXJyWzEwMDAwMDBdOwoKaW50IG1haW4oKXsKCiAgICBsbCBuOwogICAgY2luID4+IG47CiAgICBmb3IobGwgaSA9IDA7IGkgPCBuOyBpKyspewogICAgICAgIGNpbiA+PiBhcnJbaV07CiAgICB9CiAgICBsbCBzdW0gPSAwOwogICAgZm9yKGxsIGkgPSAwOyBpIDwgNjA7IGkrKyl7CiAgICAgICAgbGwgb2MgPSAwLCB6YyA9IDA7CiAgICAgICAgZm9yKGxsIGogPSAwOyBqIDwgbjsgaisrKXsKICAgICAgICAgICAgaWYoYXJyW2pdJTIgPT0gMCl7CiAgICAgICAgICAgICAgICB6YysrOwogICAgICAgICAgICB9CiAgICAgICAgICAgIGVsc2V7CiAgICAgICAgICAgICAgICBvYysrOwogICAgICAgICAgICB9CiAgICAgICAgICAgIGFycltqXSAvPSAyOwogICAgICAgIH0KICAgICAgICBzdW0gPSAoc3VtICsgKHpjKm9jKigobGwpMTw8aSklTU9EKSVNT0QpJU1PRDsKICAgIH0KICAgIGNvdXQgPDwgc3VtOwp9