def main():
    n=int(input())
    a=list(map(int,input().split()))
    ans=0
    temp=0
    MOD=10**9+7
    cnt1=[0]*60
    for num in a:
        for i in range(60):
            cnt1[i] += (num >> i) & 1
    for i in range(60):
        ans += cnt1[i] * (n - cnt1[i]) * pow(2,i,MOD)
    print(ans % MOD)


if __name__=='__main__':
    main()
