MOD = 10**9 + 7


def main():
    N = int(input())
    AN = map(int, input().split())

    digits_ct = [(0, 0) for _ in range(65)]

    for A in AN:
        temp = A

        length = 0
        for _ in range(65):
            digit = temp & 0b1

            zero, one = digits_ct[length]
            if digit == 0:
                digits_ct[length] = (zero + 1, one)
            else:
                digits_ct[length] = (zero, one + 1)

            temp = temp >> 1
            length += 1

    ans = 0
    radix = 1
    for digit_ct in digits_ct:
        zero, one = digit_ct
        ans += (((zero * one) % MOD) * radix) % MOD
        ans = ans % MOD

        radix *= 2

    print(ans)


main()
