import sys
input = sys.stdin.readline


def main():
    MOD = 10 ** 9 + 7
    N = int(input())
    A = [int(x) for x in input().split()]

    x = [0] * 61
    for i in range(N):
        for j in range(61):
            if A[i] >> j & 1:
                x[j] += 1
    ans = sum(A) * (N - 1)
    for i, v in enumerate(x):
        if v == 0 or v == 1:
            continue
        else:
            z = (2 ** i) * (v * (v - 1))
            ans = ans - z

    print(ans % MOD)







if __name__ == '__main__':
    main()

