#include <bits/stdc++.h>
using namespace std;
string *a;
vector<int> *g;
int n, m, cnt;
int *match;
int *tme;
int nor(int x, int y) {
  --x;
  return (x * m + y) * 2 - 1;
}
int nod(int x, int y) { return nor(x, y) + 1; }
bool checkr(int x, int y) { return a[x][y] == '#' && a[x][y + 1] == '#'; }
bool checkd(int x, int y) { return a[x][y] == '#' && a[x + 1][y] == '#'; }
bool dfs(int o, int timestamp) {
  if (tme[o] == timestamp) return false;
  tme[o] = timestamp;
  for (auto t : g[o]) {
    if (!match[t] || dfs(match[t], timestamp)) {
      match[match[t] = o] = t;
      return true;
    }
  }
  return false;
}
int main() {
  cin >> n >> m;
  a = new string[n + 2];
  g = new vector<int>[n * m * 2 + 1];
  match = new int[n * m * 2 + 1];
  tme = new int[n * m * 2 + 1];
  fill(match, match + n * m * 2 + 2, 0);
  fill(tme, tme + n * m * 2 + 2, 0);
  for (int i = 1; i <= n; ++i) {
    cin >> a[i];
    a[i] = '*' + a[i] + '*';
  }
  a[n + 1] = string(m + 2, '*');
  cnt = 0;
  for (int i = 1; i <= n; ++i)
    for (int j = 1; j <= m; ++j) {
      if (a[i][j] == '#') ++cnt;
      bool u(checkr(i, j));
      bool l(checkd(i, j));
      bool r(checkd(i, j + 1));
      bool d(checkr(i + 1, j));
      if (u && l) {
        g[nor(i, j)].push_back(nod(i, j));
        g[nod(i, j)].push_back(nor(i, j));
      }
      if (u && r) {
        g[nor(i, j)].push_back(nod(i, j + 1));
        g[nod(i, j + 1)].push_back(nor(i, j));
      }
      if (d && l) {
        g[nod(i, j)].push_back(nor(i + 1, j));
        g[nor(i + 1, j)].push_back(nod(i, j));
      }
      if (d && r) {
        g[nod(i, j + 1)].push_back(nor(i + 1, j));
        g[nor(i + 1, j)].push_back(nod(i, j + 1));
      }
      if (u) --cnt;
      if (l) --cnt;
    }
  int timestamp(0);
  for (int i = 1; i <= n * m * 2; i += 2)
    if (!match[i]) {
      ++timestamp;
      if (dfs(i, timestamp)) ++cnt;
    }
  cout << cnt;
  delete[] a;
  delete[] g;
  delete[] match;
  delete[] tme;
  return 0;
}
