Ciel and Receipt - On Submission Wrong Answer ? What is wrong with my code?

CIELRCPT
my code

try:
    for i in range(int(input())):
        p = int(input())
        n = p
        menu = 0
        rem = 0
        stri = ''
        while n > 0:
            rem = n % 2
            stri = stri + str(rem)
            n = n - rem
            n = n // 2
        stri = stri[::-1]
        if p in range(1,2049):
            for j in stri:
                menu += int(j)
            print(menu)
        else:
            for j in stri:
                menu += int(j)
            if menu == 1:
                print(p//2048)
            else:
                print(menu)

except: pass