def main():
    from collections import defaultdict
    n, *a = map(int, open(0).read().split())
    d = defaultdict(int)

    for i in a:
        x = bin(i)[2:]
        for j, k in enumerate(x[::-1], 1):
            if k == '1':
                d[j] += 1

    ans = 0
    mod = 10 ** 9 + 7
    for k, v in d.items():
        ans += pow(2, k, mod) * v * (n - v)
    ans = ans // 2
    print(ans % mod)


if __name__ == '__main__':
    main()
