def main():
    n =int(input())
    al = list(map(int,input().split()))

    res = 0
    bits = [[0]*2 for _ in range(60)]
    for a in al:
        i = 0
        while a > 0:
            bits[i][a&1] += 1
            a == a >> 1
            d += 1

    res = 0

    for i in range(60):
        res += bits[i][0] * bits[i][1]  * (2 ** i)

    print(res % (10 ** 9 + 7))

if __name__ == "__main__":
    main()