#include <iostream>
#include <vector>
using namespace std;

int main()
{
    long long N;
    cin>>N;
    vector<long long> A(N);
    for (long long &a: A)
        cin>>a;

    long long M = 1000000007LL;
    long long ans = 0;
    for (long long d=0; d<60; d++)
    {
        long long c = 0;
        for (long long a: A)
            c += a>>d&1;
        ans += (1LL<<d)%M*c%M*(N-c)%M;
        ans %= M;
    }
    cout<<ans<<endl;
}
