#include <iostream>
#include <cmath>
#include <vector>
#include <string>
#include <map>
#include <algorithm>
#include <limits>
#include <ios>
#include <iomanip>
#include <stdio.h>
#include <iomanip>
#include <queue>
#include <set>
using namespace std;

#define rep(i,N) for(int (i)=0; (i)<(N); (i)++)
#define revrep(i,N) for(int (i)=(N)-1; (i)>=0; (i)--)
#define dump(vec) for(int i = 0; i < (vec).size(); i++){cout << vec.at(i) << ",";}cout << endl

typedef long long ll;

int main(void)
{
    int N = 0;
    cin >> N;
    vector<ll> A(N);
    rep(i,N) {
        cin >> A.at(i);
    }

    vector<ll> keta(101,0);
    rep(k,61){
        ll s = 0;
        ll t = 0;
        rep(i,N) {
            if (((A.at(i) >> k )& 0x01) == 1) {
                t++;
            } else {
                s++;
            }
        }
        ll u = s*t;a
        keta.at(k) = u;
    }
    //dump(keta);

    rep(k,keta.size()-1){
        keta.at(k+1) += (keta.at(k)/2);
        if(keta.at(k) % 2 == 1) {
            keta.at(k) = 1;
        } else {
            keta.at(k) = 0;
        };
    }

    //dump(keta);

    ll ret = 0;
    rep(k,keta.size()){
        if (keta.at(k)) {
            ll temp = 1;
            rep(i,k){
                temp *= 2;
                temp %= (1000000000+7);
            }
            ret += temp;
            ret %= (1000000000+7);
        }        
    }

    cout << ret << endl;
    

    return 0;
}
