def main():
    n = int(input())
    a = [format(i, "b") for i in map(int, input().split())]
    mod = 10**9+7
    b = [0 for _ in range(61)]

    for i in range(n):
        for j in range(1, len(a[i])+1):
            b[j-1] += int(a[i][-j])

    result = 0
    for i in range(61):
        r = b[i]*(n-b[i])%mod
        for j in range(i):
            r = r*2 %mod
        result += r
    print(result%mod)

if __name__=="__main__":
    main()