#include <bits/stdc++.h>
using namespace std;
const int Inf = 0x3f3f3f3f;
const long long INF = 0x3f3f3f3f3f3f3f3fll;
int n, m;
char t[205][205];
int cnt = 0, id[205][205][2];
struct Netflow {
  struct Edge {
    int to, cap, rev;
    Edge(int to, int cap, int rev) : to(to), cap(cap), rev(rev) {}
  };
  vector<Edge> egs[1 << 17];
  int bg, en;
  int dis[1 << 17], iter[1 << 17];
  void inline addedge(int u, int v, int cap) {
    egs[u].push_back(Edge(v, cap, ((int)(egs[v]).size())));
    egs[v].push_back(Edge(u, 0, ((int)(egs[u]).size()) - 1));
  }
  bool inline bfs() {
    memset(dis, -1, sizeof(dis));
    queue<int> q;
    q.push(bg);
    dis[bg] = 0;
    while (((int)(q).size())) {
      int now = q.front();
      q.pop();
      for (int i = 0; i < (((int)(egs[now]).size())); i++) {
        Edge &e = egs[now][i];
        if (e.cap && !~dis[e.to]) {
          dis[e.to] = dis[now] + 1;
          q.push(e.to);
        }
      }
    }
    return ~dis[en];
  }
  int inline dfs(int now, int cap) {
    if (now == en) return cap;
    int fl = 0;
    for (int &i = iter[now]; i < ((int)(egs[now]).size()); i++) {
      Edge &e = egs[now][i];
      if (e.cap && dis[e.to] > dis[now]) {
        int f = dfs(e.to, min(cap, e.cap));
        if (!f) continue;
        e.cap -= f;
        egs[e.to][e.rev].cap += f;
        fl += f;
        cap -= f;
      }
    }
    return fl;
  }
  int inline get(int S, int T) {
    bg = S;
    en = T;
    int res = 0;
    while (bfs()) {
      memset(iter, 0, sizeof(iter));
      res += dfs(S, Inf);
    }
    return res;
  }
} nf;
int main() {
  scanf("%d%d", &n, &m);
  for (int i = 0; i < (n); i++) scanf("%s", t[i]);
  memset(id, 0, sizeof(id));
  int T = ++cnt, bs = 0;
  for (int i = 0; i < (n); i++)
    for (int j = 0; j < (m); j++) {
      if (t[i][j] == '#' && t[i][j + 1] == '#') {
        id[i][j][0] = ++cnt;
        nf.addedge(0, cnt, 1);
      }
      if (t[i][j] == '#' && t[i + 1][j] == '#') {
        id[i][j][1] = ++cnt;
        nf.addedge(cnt, T, 1);
      }
      if (t[i][j] == '#') bs++;
    }
  for (int i = 0; i < (n); i++)
    for (int j = 0; j < (m); j++) {
      if (id[i][j][0] && id[i][j][1]) nf.addedge(id[i][j][0], id[i][j][1], 1);
      if (id[i][j][0] && id[i][j + 1][1])
        nf.addedge(id[i][j][0], id[i][j + 1][1], 1);
      if (id[i + 1][j][0] && id[i][j][1])
        nf.addedge(id[i + 1][j][0], id[i][j][1], 1);
      if (id[i + 1][j][0] && id[i][j + 1][1])
        nf.addedge(id[i + 1][j][0], id[i][j + 1][1], 1);
    }
  return 0 & printf("%d\n", bs - (cnt - 1 - nf.get(0, T)));
}
