import numpy as np


def solve(string):
    n, *a = map(int, string.split())
    # a = ["{:060b}".format(_a) for _a in a]
    a = np.asarray(a)
    m = 10**9 + 7
    ans = 0
    for i in range(60):
        s = (a & 1).sum()
        a >>= 1
        # s = "".join(d).count("1")
        # ans += s * (n - s) * pow(2, 59 - i, m)
        ans += s * (n - s) * pow(2, i, m)
        ans %= m
    return str(ans)


if __name__ == '__main__':
    import sys
    print(solve(sys.stdin.read().strip()))
