///Bismillahir Rahmanir Rahim
#include<bits/stdc++.h>
#define ll long long
#define int long long
const int mod=1e9+7;
using namespace std;
ll bigmod(ll a, ll b) {
if(b==0)return 1;
ll ret = 1;
while(b) {
if(b&1) ret = (ret*a)%mod;
b >>= 1; a = (a*a)%mod;
}
return ret;
}
main()
{
    int n;
    scanf("%lld",&n);
    int a[n+2],po[65];
    po[0]=1;
    for(int i=1;i<=62;i++)
    {
        po[i]=po[i-1]*2;
        po[i]=po[i]%mod;
    }
    for(int i=1;i<=n;i++)
    {
        scanf("%lld",&a[i]);
    }
    ll sum=0;
    for(int i=0;i<=60;i++)
    {
        int z=0,o=0;
        ll tmp=0;
        for(int j=1;j<=n;j++)
        {
            if(a[j]%2==0)z++;
            else o++;
            a[j]=a[j]/2;
        }
       // cout<<po[i]<<"#"<<endl;
       // cout<<(1<<i)<<"@"<<endl;
        tmp=(o%mod)*(z%mod)*po[i];
        tmp=tmp%mod;
        sum+=tmp;
        sum=sum%mod;
    }
    sum=sum%mod;
    printf("%lld\n",sum);
    return 0;
}
