import java.util.*;
import java.lang.*;
import java.io.*;
class Ideone
{
{
Scanner in
= new Scanner
(System.
in);
int x, y;
x = in.nextInt();
y = in.nextInt();
boolean[][] mas = new boolean[x][y];
for (int i = 0; i < x; ++i){
for (int j = 0; j < y; ++j){
char buff;
in.useDelimiter("");
buff = in.next().charAt(0);
if (buff == '.') mas[i][j] = true;
else mas[i][j] = false;
}
}
int sum = 0;
for (int i = 0; i < x; ++i){
for (int j = 0; j < y; ++j){
if (mas[i][j]){
if (i - 1 >= 0 && j - 1 >= 0) if (mas[i - 1][j] && mas[i][j - 1]) ++sum;
if (i - 1 >= 0 && j + 1 < y) if (mas[i - 1][j] && mas[i][j + 1]) ++sum;
if (i + 1 < x && j + 1 < y) if (mas[i + 1][j] && mas[i][j + 1]) ++sum;
if (i + 1 < x && j - 1 >= 0) if (mas[i + 1][j] && mas[i][j - 1]) ++sum;
}
}
}
in.close();
return;
}
}
aW1wb3J0IGphdmEudXRpbC4qOwppbXBvcnQgamF2YS5sYW5nLio7CmltcG9ydCBqYXZhLmlvLio7CiAKY2xhc3MgSWRlb25lCnsKCXB1YmxpYyBzdGF0aWMgdm9pZCBtYWluIChTdHJpbmdbXSBhcmdzKSB0aHJvd3MgamF2YS5sYW5nLkV4Y2VwdGlvbgoJewoJCVNjYW5uZXIgaW4gPSBuZXcgU2Nhbm5lcihTeXN0ZW0uaW4pOwoJCQoJCWludCB4LCB5OwoJCXggPSBpbi5uZXh0SW50KCk7CgkJeSA9IGluLm5leHRJbnQoKTsKCQlib29sZWFuW11bXSBtYXMgPSBuZXcgYm9vbGVhblt4XVt5XTsKCQlmb3IgKGludCBpID0gMDsgaSA8IHg7ICsraSl7CgkJCWZvciAoaW50IGogPSAwOyBqIDwgeTsgKytqKXsKCQkJCWNoYXIgYnVmZjsKCQkJCWluLnVzZURlbGltaXRlcigiIik7CgkJCQlidWZmID0gaW4ubmV4dCgpLmNoYXJBdCgwKTsKCQkJCWlmIChidWZmID09ICcuJykgbWFzW2ldW2pd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