print(sum('#'==list(open('/dev/stdin'))[i][(i*3)%31] for i in range(323)))