#/usr/bin/env perl use strict; use warnings; my $n = <>; my $count = 0; while ($n > 1) { if ($n % 2 == 1) { $n++; } else { $n /= 2; } $count++; } print "$count\n";