def main():
    N = int(input())
    A = list(map(int, input().split()))
    mod = 10**9+7

    A_bin_cnt = [0] * 60
    for i in range(N):
        a = A[i]
        for j in range(60):
            if a >> j & 1:
                A_bin_cnt[j] += 1
    ans = 0
    for i in range(N):
        a = A[i]
        for j in range(60):
            if not a >> j & 1:
                ans = (ans + (pow(2, j, mod) * A_bin_cnt[j]) % mod) % mod
            else:
                ans = (ans + (pow(2, j, mod) * (N - A_bin_cnt[j])) % mod) % mod
    inv2 = pow(2, mod-2, mod)
    print((ans*inv2)%mod)


if __name__ == '__main__':
    main()
