def main():
    import numpy as np
    n = int(input())
    a = np.array(list(map(int, input().split())))
    l1 = np.zeros(61, dtype=np.int64)
    mod = 10**9+7
    for cnt in range(61):
        l1[cnt] = np.sum(a % 2)
        a = a//2
    l0 = n-l1
    ans = 0
    for i in range(len(l1)):
        ans = (ans+l0[i]*l1[i]*pow(2, i, mod)) % mod
    print(ans)


main()