fun main(args:Array<String>?): Unit {
    val (m, n) = readLine()!!.trim().split(' ').map(String::toInt)
    val range = Pair(0 until n, 0 until m)
    val state = Array(m){readLine()!!.trim()}
    println((1 until m).sumBy{line -> (state[line].indices).count{col -> state[line][col] == '-' && Position(col, line).neighbor8.filter { it in range }.all{ state[it] != 'x' } && Position(col, line).neighbor2.filter{it in range}.all{state[it] != 'o' }}})
}
operator fun Array<String>.get(position: Position): Char = this[position.y][position.x]
operator fun Pair<IntRange, IntRange>.contains(that: Position): Boolean {
    return that.x in first && that.y in second
}
data class Position(val x: Int, val y: Int) {
    operator fun plus(that: Position): Position = Position(this.x + that.x, this.y + that.y)
    val neighbor2: Iterable<Position>
        get() = listOf(Position(x + 1, y), Position(x - 1, y))
    val neighbor8: Iterable<Position>
        get() = listOf(Position(0, 1), Position(1, 0), Position(1, 1), Position(0, -1), Position(-1, 0), Position(-1, -1), Position(1, -1), Position(-1, 1)).map{it + this}
}
