def main():
    n = input()
    aa = map(int, raw_input().split())
    mod = 10 ** 9 + 7 
    s = 0
    for i in xrange(60):
        c0 = 0
        c1 = 0
        mask = 1 << i
        for a in aa:
            if a & mask:
                c1 += 1
            else:
                c0 += 1
        s = (s + 2 ** i * c0 * c1) % mod
    print s


main()
