#include <bits/stdc++.h>
using namespace std;
#define int long long
const int MOD = 1000000007;
struct edge {int to,costa,costb;};


signed main() {
int n;
cin>>n;
int a,k[60]={};
for(int i=0;i<n;i++){
    cin>>a;
    for(int j=0;j<60;j++)if(a&(1ll<<j))k[j]++;
}
int ans=0;
for(int i=0;i<60;i++){
    ans=(ans+ ((((1ll<<i)%MOD)*k[i])%MOD)*(n-k[i]))%MOD;
}
cout<<ans;


return 0;
}
