#include <bits/stdc++.h>
using namespace std;
char s[205][205];
struct Edge {
  int u, v;
  int cap, flow;
  Edge() {}
  Edge(int u, int v, int cap) : u(u), v(v), cap(cap), flow(0) {}
};
struct Dinic {
  int N;
  vector<Edge> E;
  vector<vector<int>> g;
  vector<int> d, pt;
  Dinic(int N) : N(N), E(0), g(N), d(N), pt(N) {}
  void AddEdge(int u, int v, int cap) {
    if (u != v) {
      E.emplace_back(Edge(u, v, cap));
      g[u].emplace_back(E.size() - 1);
      E.emplace_back(Edge(v, u, 0));
      g[v].emplace_back(E.size() - 1);
    }
  }
  bool BFS(int S, int T) {
    queue<int> q({S});
    fill(d.begin(), d.end(), N + 1);
    d[S] = 0;
    while (!q.empty()) {
      int u = q.front();
      q.pop();
      if (u == T) break;
      for (int k : g[u]) {
        Edge &e = E[k];
        if (e.flow < e.cap && d[e.v] > d[e.u] + 1) {
          d[e.v] = d[e.u] + 1;
          q.emplace(e.v);
        }
      }
    }
    return d[T] != N + 1;
  }
  int DFS(int u, int T, int flow = -1) {
    if (u == T || flow == 0) return flow;
    for (int &i = pt[u]; i < g[u].size(); ++i) {
      Edge &e = E[g[u][i]];
      Edge &oe = E[g[u][i] ^ 1];
      if (d[e.v] == d[e.u] + 1) {
        int amt = e.cap - e.flow;
        if (flow != -1 && amt > flow) amt = flow;
        if (int pushed = DFS(e.v, T, amt)) {
          e.flow += pushed;
          oe.flow -= pushed;
          return pushed;
        }
      }
    }
    return 0;
  }
  int MaxFlow(int S, int T) {
    int total = 0;
    while (BFS(S, T)) {
      fill(pt.begin(), pt.end(), 0);
      while (int flow = DFS(S, T)) total += flow;
    }
    return total;
  }
};
int cnt[205][205][4];
int main() {
  int n, m;
  scanf("%d%d", &n, &m);
  Dinic dinic(n * m * 4 + 2);
  int source = 0, sink = n * m * 4 + 1;
  for (int i = 1; i <= n; i++) scanf("%s", s[i] + 1);
  int ans = 0, idx = 0;
  for (int i = 1; i <= n; i++) {
    for (int j = 1; j <= m; j++) {
      if (s[i][j] == '#') {
        ans++;
        if (i != 1 && s[i - 1][j] == '#') cnt[i][j][0] = cnt[i - 1][j][1];
        if (i != n && s[i + 1][j] == '#') cnt[i][j][1] = ++idx;
        if (j != 1 && s[i][j - 1] == '#') cnt[i][j][2] = cnt[i][j - 1][3];
        if (j != m && s[i][j + 1] == '#') cnt[i][j][3] = ++idx;
        for (int l = 0; l < 2; l++) {
          for (int r = 2; r < 4; r++) {
            if (cnt[i][j][l] && cnt[i][j][r])
              dinic.AddEdge(cnt[i][j][l], cnt[i][j][r], 1);
          }
        }
        if (cnt[i][j][1]) dinic.AddEdge(source, cnt[i][j][1], 1);
        if (cnt[i][j][3]) dinic.AddEdge(cnt[i][j][3], sink, 1);
      }
    }
  }
  printf("%d\n", ans - (idx - dinic.MaxFlow(source, sink)));
}
