$N=<>; ++$h{$x+=$_},$x==$N?exit!print 1:$h{$N-$x}&&exit!print 2for 1..5e3; print 3