#include <bits/stdc++.h>
using namespace std;
const int N = 2 * 200 * 200 + 2;
mt19937_64 rng(std::chrono::system_clock::now().time_since_epoch().count());
int n, m, rem, last[N], last1[N], dx[] = {0, 1}, dy[] = {1, 0}, freq, black,
                                  q[N], dis[N], rem1, is[200][200][2];
string s[N];
struct edge {
  int u, v, c, last;
} e[1000000];
void addEdge(int u, int v) {
  e[rem].u = u;
  e[rem].v = v;
  e[rem].c = 1;
  e[rem].last = last[u];
  last[u] = rem++;
  e[rem].u = v;
  e[rem].v = u;
  e[rem].c = 0;
  e[rem].last = last[v];
  last[v] = rem++;
}
int get(int x, int y, int c) {
  if (is[x][y][c] != -1) return is[x][y][c];
  return is[x][y][c] = rem1++;
}
bool getPath() {
  memset(dis, -1, sizeof dis);
  dis[0] = 0;
  int l = 0, r = 0;
  while (l <= r) {
    int u = q[l++];
    for (int cur = last[u]; cur != -1; cur = e[cur].last) {
      if (e[cur].c && dis[e[cur].v] == -1) {
        dis[e[cur].v] = dis[u] + 1;
        q[++r] = e[cur].v;
      }
    }
  }
  return dis[1] != -1;
}
bool dfs(int u) {
  if (u == 1) return 1;
  for (int &cur = last1[u]; cur != -1; cur = e[cur].last)
    if (e[cur].c && dis[e[cur].v] == dis[u] + 1) {
      if (dfs(e[cur].v)) {
        e[cur].c ^= 1;
        e[cur ^ 1].c ^= 1;
        return 1;
      }
    }
  return 0;
}
int maxFlow() {
  int ret = 0;
  while (getPath()) {
    for (int i = 0; i < N; i++) last1[i] = last[i];
    while (dfs(0)) ret++;
  }
  return ret;
}
bool good(int a, int b) {
  return min(b, a) >= 0 && a < n && b < m && s[a][b] == '#';
}
int main() {
  scanf("%d%d", &n, &m);
  rem1 = 2;
  memset(is, -1, sizeof is);
  memset(last, -1, sizeof last);
  for (int i = 0; i < n; i++) cin >> s[i];
  for (int i = 0; i < n; i++)
    for (int j = 0; j < m; j++)
      if (s[i][j] == '#') {
        addEdge(0, get(i, j, 0));
        addEdge(get(i, j, 1), 1);
        if (good(i + 1, j)) {
          if (good(i + 1, j + 1)) {
            int u = get(i, j, 0), v = get(i + 1, j, 1);
            addEdge(u, v);
          }
          if (good(i + 1, j - 1)) {
            int u = get(i, j, 0), v = get(i + 1, j - 1, 1);
            addEdge(u, v);
          }
          if (good(i, j + 1)) {
            int u = get(i, j, 0), v = get(i, j, 1);
            addEdge(u, v);
          }
          if (good(i, j - 1)) {
            int u = get(i, j, 0), v = get(i, j - 1, 1);
            addEdge(u, v);
          }
        }
        black++;
        freq += good(i, j + 1) + good(i + 1, j);
      }
  printf("%d\n", black - (freq - maxFlow()));
}
