// Template for reading lines from stdin and printing the line count to stdout.
// Copy this code to your IDE to get started.

fun main() = with(generateSequence(::readLine).toList()) {
    var p1 = 0

    for (y in indices) for (x in indices) for (d in 1..<size)
        if (sequenceOf(x to y, x + d to y, x + d to y + d, x to y + d)
                .all { (x, y) -> y in indices && x in indices && this[y][x] == '#' }
        ) p1++

    println(p1)
}