#include<bits/stdc++.h>
#include<ext/pb_ds/tree_policy.hpp>
#include<ext/pb_ds/assoc_container.hpp>
using namespace std;
using namespace __gnu_pbds;
#define ll long long
#define inf 2000000000
#define infLL 2000000000000000000
#define MAX 200005
#define sf(a) scanf("%d", &a)
#define sfl(a) scanf("%lld", &a)
#define pf(a) printf("%d\n", a)
#define pfl(a) printf("%lld\n", a)
#define Case(t) printf("Case %d: ", t)
#define pii pair<int, int>
#define MOD 1000000007

#define error(args...) { string _s = #args; replace(_s.begin(), _s.end(), ',', ' '); stringstream _ss(_s); istream_iterator<string> _it(_ss); err(_it, args); }

void err(istream_iterator<string> it) {}
template<typename T, typename... Args>
void err(istream_iterator<string> it, T a, Args... args)
{
    cerr << *it << " = " << a << endl;
    err(++it, args...);
}

clock_t t_Start;
void Start()
{
    t_Start = clock();
}
void End()
{
    double Time = (double)(clock()-t_Start)/CLOCKS_PER_SEC;
    error(Time);
}

typedef tree<int,null_type,less<int>,rb_tree_tag,tree_order_statistics_node_update>orderedSet;

ll sumXOR(ll arr[], int n)
{
    ll sum = 0;
    for (ll i = 0; i < 62; i++)
    {
        ll zc = 0, oc = 0;
        ll idsum = 0;
        for (int j = 0; j < n; j++)
        {
            if (arr[j]%2LL==0)
                zc++;
            else
                oc++;
            arr[j] /= 2LL;
        }
        idsum = ((oc%MOD) * ((zc%MOD) * ((1LL<<i)%MOD))%MOD)%MOD;
        sum = (sum%MOD + idsum%MOD)%MOD;
    }
    return sum%MOD;
}

int main()
{
    //freopen("in.txt","r",stdin);
    //freopen("out.txt","w",stdout);
    //Start();

    int n;
    cin>>n;
    ll a[n+5];
    for(int i = 0; i < n; i++)
        cin>>a[i];

    ll ans = sumXOR(a, n);
    cout<<ans<<endl;

    //End();
    return 0;
}
