def main():
    n = int(input())
    a = list(map(int,input().split()))
    mod = 10**9+7
    div = {}
    for i in range(61):
        div[i] = 0
    for i in range(n):
        c = 0
        while a[i]>0:
            if a[i] %2 == 1:
                div[c] += 1
            a[i] = a[i]//2
            c+=1
    ans = 0
    for k in div.keys():
        ans += div[k] * (n-div[k]) * 2**k
        ans = ans % mod
    print(ans)

if __name__ == "__main__":
    main()
