#!/usr/bin/perl use 5.14.2; use warnings; my $pow = 32; my $count = 0; my $x = <>; while ($x > 0) { if($pow <= $x) { $x -= $pow; $count ++; } else { $pow >>= 1; } } print $count;