#include<bits/stdc++.h> using namespace std; int n; int arr[4]={1,4,16,64}; int need[4]; int solve() { int res=0; int val=1024-n; int loop=3; while( val ) { res+=( val/arr[loop] ); val%=arr[loop]; --loop; } return res; } int main() { while( ~scanf("%d",&n) ) { printf("%d\n",solve() ); } return 0; }