def main():
    MOD = 10 ** 9 + 7

    N = int(input())
    *a, = map(int, input().split())

    b = [0] * 60
    for x in a:
        for j in range(60):
            b[j] += (x & 1) > 0
            x >>= 1

    t = 1
    ans = 0
    for j in range(60):
        ans = (ans + b[j] * (N - b[j]) * t) % MOD
        t <<= 1
    print(ans)


if __name__ == '__main__':
    main()

# import sys
#
# sys.setrecursionlimit(10 ** 7)
#
# input = sys.stdin.readline
# rstrip()
# int(input())
# map(int, input().split())
