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


main()
