#include <bits/stdc++.h>
int main(void) {
  char s[256] = {};
  int ok[100001] = {};
  int x, y, z;
  int i, j;
  int pi;
  int n, m;
  int ng[100001] = {};
  int flg = 0;
  int ngcount = 0;
  int count = 0;
  int h, w;
  int world;
  int pin_x = 0;
  int pin_y = 0;
  int jama = 0;
  char date[2569][2569] = {};
  scanf("%d %d", &h, &w);
  for (i = 0; i <= h; i++) {
    for (j = 0; j <= w; j++) {
      scanf("%c", &date[i][j]);
    }
  }
  for (i = 0; i <= h; i++) {
    for (j = 0; j <= w; j++) {
    }
  }
  for (i = 0; i <= h; i++) {
    for (j = 0; j <= w; j++) {
      if (date[i][j] == '#') {
        jama++;
      }
    }
  }
  if (jama == 0) {
    printf("%d", h - 1 + w - 1);
  } else {
    printf("%d", h * w - 1 - jama);
  }
}
