#include <iostream>
using namespace std;
int main() {
int x, y;
cin >> x >> y;
bool **mas = new bool*[x];
for (int i = 0; i < x; ++i){
mas[i] = new bool[y];
}
for (int i = 0; i < x; ++i){
for (int j = 0; j < y; ++j){
char buff;
cin >> buff;
if (buff == '.') mas[i][j] = true;
else mas[i][j] = false;
}
cout << endl;
}
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;
}
}
}
cout << sum;
return 0;
}
I2luY2x1ZGUgPGlvc3RyZWFtPgp1c2luZyBuYW1lc3BhY2Ugc3RkOwoKaW50IG1haW4oKSB7CglpbnQgeCwgeTsKCWNpbiA+PiB4ID4+IHk7Cglib29sICoqbWFzID0gbmV3IGJvb2wqW3hdOwoJZm9yIChpbnQgaSA9IDA7IGkgPCB4OyArK2kpewoJCW1hc1tpXSA9IG5ldyBib29sW3ldOwoJfQoJZm9yIChpbnQgaSA9IDA7IGkgPCB4OyArK2kpewoJCWZvciAoaW50IGogPSAwOyBqIDwgeTsgKytqKXsKCQkJY2hhciBidWZmOwoJCQljaW4gPj4gYnVmZjsKCQkJaWYgKGJ1ZmYgPT0gJy4nKSBtYXNbaV1bal0gPSB0cnVlOyAKCQkJZWxzZSBtYXNbaV1bal0gPSBmYWxzZTsKCQl9CgkJY291dCA8PCBlbmRsOwoJfQoJaW50IHN1bSA9IDA7Cglmb3IgKGludCBpID0gMDsgaSA8IHg7ICsraSl7CgkJZm9yIChpbnQgaiA9IDA7IGogPCB5OyArK2opewoJCQlpZiAobWFzW2ldW2pdKXsKCQkJCWlmIChpIC0gMSA+PSAwICY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