#include<bits/stdc++.h>
using namespace std;
int n, m;
char a[1010][1010];
bool ans[1010][1010];
bool vis[1010][1010];
int zou[4][2] = {{1, 0}, {0, 1}, {-1, 0}, {0, -1}};
int main() {
cin >> n >> m;
for (int i = 0; i < n; ++i)for (int j = 0; j < m; ++j)cin >> a[i + 1][j + 1];
queue<pair<int, int> > q;
q.push(make_pair(0, 0));
while (q.size()) {
pair<int, int> f = q.front();
q.pop();
vis[f.first][f.second] = true;
if (a[f.first][f.second] == '*')continue;
if (f.first < 0 || f.second < 0 || f.first > n || f.second > m) {
continue;
}
ans[f.first][f.second] = true;
for (int i = 0; i < 4; ++i)if (!vis[f.first + zou[i][0]][f.second + zou[i][1]])q.push(make_pair(f.first + zou[i][0], f.second + zou[i][1]));
}
int cnt = 0;
for (int i = 1; i <= n; ++i)for (int j = 1; j <= m; ++j)if (!ans[i][j] && a[i][j]^'*')++cnt;
cout << cnt;
return 0;
}