#include <bits/stdc++.h>
using namespace std;
int main(void) {
  long long h, w;
  cin >> h >> w;
  string s[h];
  long long count = 0;
  long long MAX = -1;
  for (long long i = 0; i < h; i++) cin >> s[i];
  for (long long i = 0; i < w; i++) {
    for (long long j = 0; j < h; j++) {
      if (s[j][i] == '#') {
        count++;
        MAX = max(MAX, j);
      }
    }
  }
  long long ans;
  if (MAX < h - 1)
    ans = h + w - 2;
  else
    ans = h + w - 2 + count;
  cout << ans << endl;
  return 0;
}
