#include <bits/stdc++.h>
using namespace std;
int n, m, l, ll, odp;
int p[202][202][4];
int sko[200000];
int odw[200000];
char s[202][202];
vector<int> v[200000];
bool skoj(int x) {
  odw[x] = ll;
  for (int i : v[x]) {
    if (!sko[i]) {
      sko[x] = i;
      sko[i] = x;
      return true;
    }
  }
  for (int i : v[x]) {
    if (odw[sko[i]] < ll) {
      if (skoj(sko[i])) {
        sko[x] = i;
        sko[i] = x;
        return true;
      }
    }
  }
  return false;
}
int main() {
  scanf("%d%d", &n, &m);
  for (int i = 1; i <= n; ++i) {
    scanf("%s", s[i] + 1);
    for (int j = 1; j <= m; ++j) {
      odp += s[i][j] == '#';
    }
  }
  for (int i = 2; i <= n; ++i) {
    for (int j = 1; j <= m; ++j) {
      if (s[i][j] == '#' && s[i - 1][j] == '#') {
        ++l;
        p[i][j][0] = l;
        p[i - 1][j][2] = l;
      }
    }
  }
  for (int i = 1; i <= n; ++i) {
    for (int j = 2; j <= m; ++j) {
      if (s[i][j] == '#' && s[i][j - 1] == '#') {
        ++l;
        p[i][j][3] = l;
        p[i][j - 1][1] = l;
      }
    }
  }
  for (int i = 1; i <= n; ++i) {
    for (int j = 1; j <= m; ++j) {
      if (s[i][j] == '#' && s[i - 1][j] == '#' && s[i][j + 1] == '#') {
        v[p[i][j][0]].push_back(p[i][j][1]);
        v[p[i][j][1]].push_back(p[i][j][0]);
      }
      if (s[i][j] == '#' && s[i - 1][j] == '#' && s[i][j - 1] == '#') {
        v[p[i][j][0]].push_back(p[i][j][3]);
        v[p[i][j][3]].push_back(p[i][j][0]);
      }
      if (s[i][j] == '#' && s[i + 1][j] == '#' && s[i][j + 1] == '#') {
        v[p[i][j][2]].push_back(p[i][j][1]);
        v[p[i][j][1]].push_back(p[i][j][2]);
      }
      if (s[i][j] == '#' && s[i + 1][j] == '#' && s[i][j - 1] == '#') {
        v[p[i][j][2]].push_back(p[i][j][3]);
        v[p[i][j][3]].push_back(p[i][j][2]);
      }
    }
  }
  for (int i = 1; i <= l; ++i) {
    if (!sko[i]) {
      ++ll;
      odp += skoj(i);
    }
  }
  printf("%d\n", odp - l);
  return 0;
}
