#include <bits/stdc++.h>
using namespace std;
int main() {
  int H, W, Sum1 = 0, Sum2 = 0;
  cin >> H >> W;
  vector<string> S(H);
  for (int i = 0; i < (int)(H); i++) cin >> S.at(i);
  for (int i = 0; i < (int)(H); i++) {
    for (int j = 0; j < (int)(W); j++)
      if (S.at(i).at(j) == '#') Sum1++;
  }
  if (Sum1 % 2 != 0) Sum1++;
  cout << H + W - 2 + Sum1 << endl;
}
