#include <bits/stdc++.h>
#pragma GCC optimize("O2")
using namespace std;
struct Dinic {
  static const int MXN = 100010;
  struct Edge {
    int v, f, re;
  };
  int n, s, t, level[MXN];
  vector<Edge> E[MXN];
  void init(int _n, int _s, int _t) {
    n = _n;
    s = _s;
    t = _t;
    for (int i = 0; i < n; i++) E[i].clear();
  }
  void add_edge(int u, int v, int f) {
    E[u].push_back({v, f, (int)E[v].size()});
    E[v].push_back({u, 0, (int)E[u].size() - 1});
  }
  bool BFS() {
    for (int i = 0; i < n; i++) level[i] = -1;
    queue<int> que;
    que.push(s);
    level[s] = 0;
    while (!que.empty()) {
      int u = que.front();
      que.pop();
      for (auto &it : E[u]) {
        if (it.f > 0 && level[it.v] == -1) {
          level[it.v] = level[u] + 1;
          que.push(it.v);
        }
      }
    }
    return level[t] != -1;
  }
  int DFS(int u, int nf) {
    if (u == t) return nf;
    int res = 0;
    for (auto &it : E[u]) {
      if (it.f > 0 && level[it.v] == level[u] + 1) {
        int tf = DFS(it.v, min(nf, it.f));
        res += tf;
        nf -= tf;
        it.f -= tf;
        E[it.v][it.re].f += tf;
        if (nf == 0) return res;
      }
    }
    if (!res) level[u] = -1;
    return res;
  }
  int flow(int res = 0) {
    while (BFS()) res += DFS(s, 2147483647);
    return res;
  }
} flow;
string a[202];
int hid[202][202], vid[202][202];
int main() {
  cin.tie(0), ios::sync_with_stdio(0);
  int n, m;
  cin >> n >> m;
  for (int i = 0; i < n; i++) cin >> a[i];
  int cid = 0;
  for (int i = 0; i + 1 < n; i++) {
    for (int j = 0; j < m; j++) {
      if (a[i][j] == '#' && a[i + 1][j] == '#') {
        hid[i][j] = ++cid;
      }
    }
  }
  int mid = cid;
  for (int i = 0; i < n; i++) {
    for (int j = 0; j + 1 < m; j++) {
      if (a[i][j] == '#' && a[i][j + 1] == '#') {
        vid[i][j] = ++cid;
      }
    }
  }
  flow.init(cid + 2, 0, cid + 1);
  for (int i = 1; i <= mid; i++) flow.add_edge(flow.s, i, 1);
  for (int i = mid + 1; i <= cid; i++) flow.add_edge(i, flow.t, 1);
  for (int i = 0; i + 1 < n; i++) {
    for (int j = 0; j < m; j++) {
      if (hid[i][j]) {
        if (j && vid[i][j - 1]) flow.add_edge(hid[i][j], vid[i][j - 1], 1);
        if (j + 1 < m && vid[i][j]) flow.add_edge(hid[i][j], vid[i][j], 1);
        if (j && vid[i + 1][j - 1])
          flow.add_edge(hid[i][j], vid[i + 1][j - 1], 1);
        if (j + 1 < m && vid[i + 1][j])
          flow.add_edge(hid[i][j], vid[i + 1][j], 1);
      }
    }
  }
  int ans = 0;
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < m; j++) ans += (a[i][j] == '#');
  }
  ans -= (cid - flow.flow());
  cout << ans << "\n";
  return 0;
}
