import std.stdio, std.array, std.string, std.conv, std.algorithm;
import std.typecons, std.range, std.random, std.math, std.container;
import std.numeric, std.bigint, core.bitop, core.stdc.string;

immutable long MOD = 998244353;

void main() {
    auto N = readln.chomp.to!int;
    auto S = N.iota.map!(_ => readln.chomp).array;
    int ans = 0;
    int[] dr = [0, -1, -1, 1, 1];
    int[] dc = [0, -1, 1, -1, 1];

    foreach (r; 1..N-1) {
        foreach (c; 1..N-1) {
            int ok = 1;
            foreach (k; 0..5) {
                int nr = r + dr[k];
                int nc = c + dc[k];
                if (S[nr][nc] == '.') {
                    ok = 0;
                    break;
                }
            }
            ans += ok;
        }
    }

    ans.writeln;
}
