#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <utility>
#include <numeric>
#include <array>

#include <boost/multiprecision/cpp_int.hpp>
#include <cmath>
#include <memory>
using namespace std;
#define DEB(variable) cout << #variable << '=' << variable << endl

#define FOR(LoopVariable,numberOFbegin,numberOFend) for (long long int LoopVariable = (numberOFbegin); (LoopVariable) < (numberOFend); (LoopVariable)++)
#define DEFOR(LoopVariable,numberOFbegin,numberOFend) for (long long int LoopVariable = (numberOFbegin)-1; (LoopVariable) >= (numberOFend); (LoopVariable)--)
#define REP(LoopVariable,numberOFend) for(long long int LoopVariable = 0;(LoopVariable)<(numberOFend);LoopVariable++)

using llint = long long int;

namespace mp = boost::multiprecision;
constexpr long long int linf = numeric_limits<long long int>::max()-5;
constexpr long long int inf= numeric_limits<int>::max()-5;
constexpr long long int mod = 1000000007;

int main(){

    mp::cpp_int n;
    cin>>n;
    vector<mp::cpp_int> v(n);
    REP(i,n){
        cin>>v[i];
    }
    mp::cpp_int h, l, result = 0;

    for (mp::cpp_int i = 1; i < (1ll << 62ll);(i<<=1)){
        h = 0;
        l = 0;
        REP(j,n){
            if(i&v[j]){
                h++;
            }else{
                l++;
            }
        }
        result += (i) * (h) * (l);
        result %= mod;
    }
    result += mod;
    result %= mod;
    cout << result << endl;
    return 0;
}
