use strict; use warnings; <> =~ / /; my $count = 0; for($`..$'){ ++$count if(!(($`+$_+$')%3)); } print $count;