#include<iostream>
#define MOD 1000000007;
using namespace std;
int main(){
    long n,ans=0LL,x;
    cin>>n;
    long a[n];
    for(int i=0;i<n;i++)cin>>a[i];
    for(int i=0;i<60;i++){
        long c=0L;
        for(int j=0;j<n;j++)if((a[j]&(1L<<i))!=0LL)c++;
        long tmp=c*(n-c),w=i;
        tmp%=MOD;
        while(w--)tmp=tmp*2%MOD;
        ans+=tmp;
        ans%=MOD;
    }
    cout<<ans<<endl;
    return 0;

}