#include <bits/stdc++.h>
using namespace std;
const int N = 2e6 + 10;
const int inf = 1e9;
int s, t, cur[N], dep[N], n, m, id[210][210], tt,
    dx[4] = {1, 0, 0, -1}, dy[4] = {0, 1, -1, 0}, h[N], to[N], ww[N], nxt[N];
char str[N];
void adde(int u, int v, int w) {
  static int tt = 1;
  to[++tt] = v;
  ww[tt] = w;
  nxt[tt] = h[u];
  h[u] = tt;
  to[++tt] = u;
  ww[tt] = 0;
  nxt[tt] = h[v];
  h[v] = tt;
}
bool bfs() {
  memset(dep, 0, 4 * (t + 1));
  queue<int> q;
  q.push(s);
  dep[s] = 1;
  while (!q.empty()) {
    int u = q.front();
    q.pop();
    for (int i = h[u], v; v = to[i], i; i = nxt[i])
      if (!dep[v] && ww[i]) {
        dep[v] = dep[u] + 1;
        q.push(v);
        if (v == t) return 1;
      }
  }
  return 0;
}
int dfs(int u, int flow) {
  if (u == t) return flow;
  int ret = 0;
  for (int &i = cur[u], v; v = to[i], i; i = nxt[i])
    if (dep[v] == dep[u] + 1 && ww[i]) {
      int d = dfs(v, min(flow, ww[i]));
      ww[i] -= d;
      ww[i ^ 1] += d;
      ret += d;
      flow -= d;
      if (!flow) break;
    }
  return ret;
}
int dinic() {
  int ret = 0;
  while (bfs()) {
    memcpy(cur, h, 4 * (t + 1));
    ret += dfs(s, inf);
  }
  return ret;
}
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cin >> n >> m;
  for (int i = 1; i <= n; i++) {
    cin >> (str + 1);
    for (int j = 1; j <= m; j++)
      if (str[j] == '#') id[i][j] = ++tt;
  }
  s = 0;
  t = tt + 1;
  for (int i = 1; i <= n; i++)
    for (int j = 1; j <= m; j++)
      if (id[i][j]) {
        int cnt0 = 0, cnt1 = 0;
        for (int k = 0; k < 4; k++) {
          int x = i + dx[k], y = j + dy[k];
          if (!(1 <= x && x <= n && 1 <= y && y <= m && id[x][y])) {
            if (k == 0 || k == 3)
              ++cnt0;
            else
              ++cnt1;
          } else
            adde(id[i][j], id[x][y], 1);
        }
        adde(s, id[i][j], cnt0);
        adde(id[i][j], t, cnt1);
      }
  cout << dinic() / 2;
  return 0;
}
