//#include<bits/stdc++.h>
//#include "/Users/student/Documents/Sublime/stdc++.h"

typedef long long ll;

using namespace std;

#define MOD (ll)1000000007

ll arr[1000000];

int main() {
//    freopen("input.in", "r", stdin);
//    freopen("output.out", "w", stdout);
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);

    int n;
    cin >> n;
    for(int i = 0; i < n; i++){
        cin >> arr[i];
    }
    ll sum = 0;
    for(int i = 0; i < 60; i++){
        ll oc = 0, zc = 0;
        for(int j = 0; j < n; j++){
            if(arr[j]%2 == 0){
                zc++;
            }
            else{
                oc++;
            }
            arr[j] = arr[j]/2;
        }
        sum = (sum + zc*oc*(1<<i))%MOD;
    }
    cout << sum;
}