#!/usr/bin/env perl
use strict;
use warnings;

open (my $fh, '<', 'input') or die "$!";

my $n;
my $i = 0;
for my $l (<$fh>) {
    chomp $l;
    if (substr($l, (3 * $i) % length($l), 1) eq '#') {
        $n++;
    }
    $i++;
}
print "$n\n";
