#include<bits/stdc++.h>
#define int long long
using namespace std;
const int INF = 1e14;
const int ZERO = 0;
const int MOD = 1000000007;
const double PI = 3.1415926535897;
typedef pair<int,int> P;

signed main() {
    int N;
    cin >> N;
    vector<int> vec(N);
    for(int i = 0;i < N;i++) {
        cin >> vec.at(i);
    }
    vector<vector<int>> d(N,vector<int>(60));
    for(int i = 0;i < N;i++) {
        for(int j = 0;j < 70;j++) {
            if(vec.at(i) % 2 == 0) {
                d[i][j] = 0;
            }
            else {
                d[i][j] = 1;
            }
            vec.at(i) /= 2;
        }
    }
    vector<int> cnt(60);
    for(int i = 0;i < 60;i++) {
        int zero = 0;
        int one = 0;
        for(int j = 0;j < N;j++) {
            if(d[j][i] == 0) {
                zero++;
            }
            else {
                one++;
            }
        }
        cnt[i] = zero * one;
    }
    int ret = 0;
    for(int i = 0;i < 60;i++) {
        int a = cnt[i] * pow(2,i) % MOD;
        ret += a;
        ret = ret % MOD;
    }
    cout << ret << endl;
}
