#include <bits/stdc++.h>
using namespace std;
int64_t mod = 1e9 + 7;
int64_t mod1 = 1e9 + 6;
int64_t power(int64_t a, int64_t b) {
  if (b == 0)
    return 1;
  else if (b % 2 == 0)
    return power((((a % mod) * (a % mod)) % mod), b / 2) % mod;
  else
    return ((a % mod) * (power((((a % mod) * (a % mod)) % mod), b / 2) % mod)) %
           mod;
}
int32_t main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  int64_t n, m;
  cin >> n >> m;
  char ch[n + 1][m + 1];
  int64_t node = n * m;
  int64_t gr[node + 1][node + 1];
  for (int64_t i = 1; i <= node; ++i) {
    for (int64_t j = 1; j <= node; ++j) gr[i][j] = 1e9;
    gr[i][i] = 0;
  }
  for (int64_t i = 1; i <= n; ++i)
    for (int64_t j = 1; j <= m; ++j) cin >> ch[i][j];
  for (int64_t i = 1; i <= n; ++i) {
    for (int64_t j = 1; j <= m; ++j) {
      if (ch[i][j] == '#') continue;
      int64_t nd = (i - 1) * n + j;
      if (i != 1) {
        if (ch[i - 1][j] == '.') {
          int64_t nd1 = (i - 2) * n + j;
          gr[nd][nd1] = 1;
        }
      }
      if (i != n) {
        if (ch[i + 1][j] == '.') {
          int64_t nd1 = (i)*n + j;
          gr[nd][nd1] = 1;
        }
      }
    }
  }
  int64_t ans = 0;
  cout << ans;
}
