//#pragma GCC optimize("Ofast")
//#pragma GCC optimize ("unroll-loops")
//#pragma GCC target("avx,avx2,fma")
#include <bits/stdc++.h>
#include<ext/pb_ds/assoc_container.hpp>
#include<ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
using namespace std;
#define mp make_pair
#define ff first
#define ss second
#define setbits(x) __builtin_popcount(x)
typedef long long ll;
typedef unsigned long long ull;
typedef double db;
typedef long double ldb;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef pair<ll, int> pli;
typedef pair<db, db> pdd;
typedef vector<int> vi;
#define m1 make_pair
#define in insert
#define pb push_back
#define IOS                           \
    std::ios::sync_with_stdio(false); \
    cin.tie(NULL);                    \
    cout.tie(NULL);
#define endl "\n"
template <typename T>
using ordered_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;

inline ll gcd(ll a, ll b)
{
    if (a == 0)
        return b;
    return gcd(b % a, a);
}
inline ll power(ll a, ll n, ll m)
{
    if (n == 0)
        return 1;
    ll p = power(a, n / 2, m);
    p = (p * p) % m;
    if (n % 2)
        return (p * a) % m;
    else
        return p;
}
const ll MOD = 1000000007;
const int N = int(2e5) + 999;
#define int long long int

int32_t main(){
    IOS;
    
    int n;
    cin>>n;
    int mx = 61;
    int arr[mx] = {0};
    for(int i=0;i<mx;i++)
    	arr[i] = 0;

    int p[mx];
    p[0]=1;
    for(int i=1;i<mx;i++)
    	p[i] = (p[i-1]*2)%MOD;

    for(int i=0;i<n;i++){
    	int x;cin>>x;
    	for(int j=0;j<mx;j++)
    		if(x&(1<<j))
    			arr[j]++;
    }
    
    int ans = 0;
    for(int i=0;i<mx;i++){
    	int one = arr[i];
    	int zero = n-one;
    	int tmp = p[i]*zero;
    	tmp%=MOD;
    	tmp = (tmp*one)%MOD;
    	ans = ans + tmp;
    	ans%=MOD;
    }

    cout<<ans<<endl;

    return 0;
}