/**akshaykumar99**/
 
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>

using namespace std;
using namespace __gnu_pbds;
 
template<typename T> using id_set = tree<T,null_type,less<T>,rb_tree_tag,tree_order_statistics_node_update> ;
template<typename T> using id_setp = tree<pair<T,T>,null_type,less<pair<T,T>>,rb_tree_tag,tree_order_statistics_node_update> ;

#define f(i,x,n) for(i=x;i<n;i++)
#define fr(i,x,n) for(i=x;i>=n;i--)
#define pu push_back           
#define pp pop_back
#define F first
#define S second
#define all(v) v.begin(),v.end()
#define rall(v) v.rbegin(),v.rend()
#define SP(x) fixed<<setprecision(x)
#define IOS() ios::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
 
const long long MOD=1e9+7;
const long double PI = acos(-1);
const long long INF=INT_MAX;
const long long LINF=LLONG_MAX;
const long long N=1e5+1;
 
typedef long long ll;
typedef long double ld;
 
int main()
{
    IOS();
    
    //reference geeks for geeks
    ll n,i,j,x=0,ans=0;
    cin>>n;
    ll a[n];
    f(i,0,n)
        cin>>a[i];
    f(i,0,64)  
    { 
        ll zc = 0, oc = 0;  
        ll sum = 0;  
        f(j,0,n)
        { 
            if(a[j] % 2 == 0) 
                zc++; 
            else
                oc++; 
            a[j]/=2; 
        } 
        sum = oc*zc*(ll)(pow(2,i));    
        ans+=(sum%MOD);
        ans%=MOD;  
    } 
    cout<<ans<<'\n';

    return 0;
}