// 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 p2 = 0

    for (y in indices) for (x in indices) for (d in 1..<size) for (d1 in 1..d) {
        this[y][x] == '#' || continue
        val d2 = d - d1
        sequenceOf(0 to 0, d1 to d2, d1 - d2 to d, -d2 to d1)
            .all { (dx, dy) -> y + dy in indices && x + dx in indices && this[y + dy][x + dx] == '#' } || continue
        p2++
    }

    println(p2)
}
