#include<bits/stdc++.h>

long long pow_mod(long long base,long long exp,long long mod){
    long long res = 1;
    while(exp>0){
        if(exp & 1)res = res * base % mod;
        base = base * base % mod;
        exp >>= 1;
    }
    return res;
}

const int mood = 1000000007;     
int main()
{
    int n;
    std::cin>>n;
    std::vector<long long> a(n);
    std::vector<std::pair<int,int>> eo(61); //first 1 second 0
    for(int i=0;i<61;i++)eo[i] = {0,0};
    for(int i=0;i<n;i++){
        std::cin>>a[i];
        for(long long j=0;j<60;j++){
            if(a[i] & ((long long)1<<j))eo[j].first++;
            else eo[j].second++;
        }
    }
    long long ans = 0;
    for(int i=0;i<61;i++){
        //std::cout<<eo[i].first<<" : "<<eo[i].second<<std::endl;;
        int tmp = (eo[i].first * eo[i].second) % mood;
        long long kake = std::pow_mod(2,i,mood);
        ans += tmp*kake;
        ans %= mood;
    }
    std::cout<<ans<<std::endl;
}
