c++

#include<iostream>
using namespace std;
int main()
{
    int n,a = 1,b = 1,c = 1,d = 1,sum = 0;
    cin>>n;
    n = 1024 - n;
    a = (n - n % 64) / 64;
    n = n % 64;
    b = (n - n % 16) / 16;
    n = n % 16;
    c = (n - n % 4) / 4;
    d = n % 4;
    sum = a + b + c + d;
    cout<<sum;
    return 0;
}

python

class Solution :
    def __init__(self,n) :
        self.n = 1024 - n 
        self.sum = 0
    def fun(self) :         #这里的'//'表示整除
        self.sum += self.n // 64 + (self.n % 64) // 16 + ((self.n % 64) % 16) // 4 + ((self.n % 64) % 16) % 4
    def resum(self) :
        return self.sum
n = int(input())
s = Solution(n)
s.fun()
print(s.resum())