if __name__ == '__main__':
    n = int(input())
    a = list(map(int, input().split()))

    ans = 0
    for i in range(60):
        # count = 0
        # b = []
        b = [1 if a[j] & (1 << i) == 2 ** i else 0 for j in range(n)]
        count = sum(b)
        # for j in range(n):
        #     b = [1 if a[j] & (1 << i) == 2**i else 0 for j in range(n)]
        #     if a[j] & (1 << i) == 2**i:
        #         count += 1
        ans += (2**i) * (count * (n - count))

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