#pragma GCC optimize("O3")
#pragma comment(linker, "/stack:200000000")
#pragma GCC optimize("unroll-loops")

#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>

using namespace std;
using namespace __gnu_pbds; 

#define pb push_back
#define eb emplace_back
#define mp make_pair
#define all(v) (v).begin(),(v).end()
#define f first
#define s second
#define sz(x) ll(x.size())
#define endl '\n'
#define forn(i,n) for(int i=0;i<n;++i)
#define fore(i,l,r) for(int i=int(l);i<=int(r);++i)
#define rep(i,begin,end) for(__typeof(end) i=(begin);i!=(end);i++)
#define fill(a,value) memset(a,value,sizeof(a));
#define gcd(a,b) __gcd((a),(b))
#define watch1(x) cout << (x) << endl
#define watch2(x,y) cout << (x) << " " << (y) << endl
#define watch3(x,y,z) cout << (x) << " " << (y) << " " << (z) << endl
#define fastio ios_base::sync_with_stdio(false);cin.tie(NULL);
 
typedef long long ll;
typedef long double ld; 
typedef pair<int,int> pii;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<pii> vpii;
typedef tree<pii, null_type, less<pii>, rb_tree_tag, tree_order_statistics_node_update> oset;
 
const ll mod = 1e9 + 7;
const int inf = 1e9 + 5;
const int N = 3e5 + 5;

ll a[N];

signed main(){
    fastio;
    int i,j,n;
    cin>>n;
    for(i=1;i<=n;++i){
        cin>>a[i];
    }
    ll ans=0;
    for(j=0;j<62;++j){
        int s=0,ns=0;
        for(i=1;i<=n;++i){
            if(a[i]&(1ll<<j))
                ++s;
            else
                ++ns;
        }
        ll p=(1ll<<j)%mod;
        ans+=s*ns*p;
        ans%=mod;
    }
    cout<<ans;
    return 0;
}