<>; $a[$_]=++$n for glob<>; for(@a){ if($-<$s-$_){ $-=$s-$_; } $s+=$_; } print$-;