""" day_03_01.py """

# usage: python3 day_03_01.py < input

import sys
from collections import namedtuple


Point = namedtuple('Point', ['x', 'y'])

with sys.stdin as infile:
    raw = infile.read()

forest = {Point(x, y) for y, row in enumerate(raw.splitlines())
          for x, obj in enumerate(row) if obj == '#'}

width = max(forest, key=lambda p: p.x).x
height = max(forest, key=lambda p: p.y).y

total = 0

for size in range(1, min(width, height) + 1):
    for x, y in forest:
        corners = {Point(x, y), Point(x + size, y + size),
                   Point(x + size, y), Point(x, y + size)}
        if corners <= forest:
            total += 1

print(total)
