 #include <bits/stdc++.h>
 #define ll long long
 #define int long long
 #define MOD  1000000007
 #define MAX 500005
 #include<iomanip>
 #define Need_for_speed(activated) ios_base :: sync_with_stdio(0);cin.tie(NULL);cout.tie(NULL)
 #define satisfy ll t; cin>> t; while(t--)
 #define inp(n) int n;cin >> n
 #define mp make_pair
 #define pb push_back
 #define fore(i,a,b) for(ll i=a;i<b;i++)
 #define x first
 #define y second
using namespace std;
int gcd(int a, int b);
  
int power(int x, unsigned int y, unsigned int m)
{
    if (y == 0)
        return 1;
    int p = power(x, y/2, m) % m;
    p = (p * p) % m;
  
    return (y%2 == 0)? p : (x * p) % m;
}
ll modInverse(int a, int m)
{
    int g = gcd(a, m);
   
    {
        // If a and m are relatively prime, then modulo inverse
        // is a^(m-2) mode m
      
             return power(a, m-2, m);
    }
}
int gcd(int a, int b)
{
    if (b == 0)
        return a;
    return gcd(b, a % b);

}
//void spf(ll num)
//{
//    fore(i,0,num+1)arr[i]=i;
//    for(ll i=2;i<=num;i+=2)
//    {
//        arr[i]=2;
//    }
//    for(ll i=3;i<=num;i+=2)
//    {
//        if(arr[i]==i)
//        for(ll j=i;j<=num;j+=i)
//        {
//           if(arr[j]==j) arr[j]=i;
//        }
//    }
//}
 
 int32_t main()
{
    Need_for_speed(activated);
//    satisfy
//    {}
    ll arr[300006][100]={0};
    ll n;cin>>n;
     fore(i,0,n)
    {
        ll x;cin>>x;
        ll b=0;
        while(x)
        {
            arr[i][b]=x%2;
            x/=2;
            b++;
        }
    }
    ll ans[300005]={0};
    ll carry=0;
    fore(i,0,100)
    {
        ll one=0,zero=0;
        for(ll j=0;j<n;j++)
        {
            if(arr[j][i]==0)zero++;
            else one++;
        }
        ll prod=zero*one;
        ans[i]=prod;
    }
    ll dd=0;ll k=1;
    for(ll i=0;i<100;i++)
    {
        dd+=(k*ans[i])%MOD;
        k=(k*2)%MOD;
        dd%=MOD;
    }
    d%=MOD;
    cout<<dd<<endl;
    return 0;
    }
