import java.util.*;
public class Main {
    public static void main(String[] args) {
        Scanner sc = new  Scanner(System.in);
        int N = 1024 - sc.nextInt();
        int cnt = 0;
        while(N >= 1024) {
            N -= 1024;
            cnt++;
        }
        while(N >= 64) {
            N -= 64;
            cnt++;
        }
        while(N >= 16) {
            N -= 16;
            cnt++;
        }
        while(N >= 4) {
            N -= 4;
            cnt++;
        }
        while(N >= 1) {
            N--;
            cnt++;
        }
        System.out.println(cnt);
    }
}