#include <iostream>
#include <iomanip>
#include <bits/stdc++.h>
#include <vector>
#include <iterator>
#include <string>
#define pan(i,n) for(int i=0;i<n;i++)
#define ll long long int
#define vi vector<int>
#define pb push_back
#define INF 1000000007
using namespace std;



int main(){
    int n;
    cin>>n;
    ll ele=0;
    ll zero[61]{0},one[61]{0};
    pan(j,n){
        cin>>ele;
        pan(i,61){
            if(ele % 2 ==1) one[i]++;
            else zero[i]++;
            ele/=2;
        }
    }
    ll sum=0;
    pan(i,60){
        sum+=((bit0[i]*bit1[i])%INF*(pow(2,i))%INF)%INF;
        // cout<<bit1[i]<<"--"<<bit0[i]<<endl;
    }
    cout<<sum;
}
