#include <bits/stdc++.h>
using namespace std;
int k, n, m, S, T, first[3000000], nex[3000000], v[3000000], now[3000000], C,
    mmax, tot, vis[3000000], all;
int num = 1, A, B;
long long ans, w[3000000], dep[3000000];
long long INF = 999999999999999;
char ch[205][205];
void Add(int s, int e, long long cd) {
  nex[++num] = first[s];
  first[s] = num;
  v[num] = e;
  w[num] = cd;
}
bool bfs(int s, int t) {
  memset(dep, 0, sizeof(dep));
  queue<int> q;
  dep[s] = 1;
  q.push(s);
  now[s] = first[s];
  while (!q.empty()) {
    int x = q.front();
    q.pop();
    for (int i = first[x]; i; i = nex[i]) {
      if (w[i] > 0 && dep[v[i]] == 0) {
        now[v[i]] = first[v[i]];
        dep[v[i]] = dep[x] + 1;
        q.push(v[i]);
        if (v[i] == t) return 1;
      }
    }
  }
  return 0;
}
long long dfs(int s, int t, long long flow) {
  if (s == t || !flow) return flow;
  long long b = 0, mmin;
  for (int i = now[s]; i; i = nex[i]) {
    now[s] = i;
    if (dep[v[i]] == dep[s] + 1 && w[i] > 0) {
      mmin = dfs(v[i], t, min(flow, w[i]));
      w[i] -= mmin;
      w[i ^ 1] += mmin;
      b = b + mmin;
      flow -= mmin;
      if (!flow) break;
    }
  }
  return b;
}
int main() {
  scanf("%d%d", &n, &m);
  for (int i = 1; i <= n; i++) {
    scanf("%s", ch[i] + 1);
  }
  S = 90001;
  T = 90002;
  for (int i = 1; i <= n; i++) {
    for (int j = 1; j <= m; j++) {
      if (ch[i][j] == '#') {
        tot++;
        int k1, k2, k3, k4;
        k1 = (i - 1) * m + j;
        k2 = i * m + j;
        k3 = k1 + n * m;
        k4 = k3 + 1;
        if (ch[i - 1][j] == '#' && vis[k1] == 0) {
          all++;
          vis[k1] = 1;
          Add(S, k1, 1);
          Add(k1, S, 0);
        }
        if (ch[i][j - 1] == '#' && vis[k3] == 0) {
          all++;
          vis[k3] = 1;
          Add(k3, T, 1);
          Add(T, k3, 0);
        }
        if (ch[i - 1][j] == '#') {
          if (ch[i][j + 1] == '#') {
            Add(k1, k4, 1);
            Add(k4, k1, 0);
          }
          if (ch[i][j - 1] == '#') {
            Add(k1, k3, 1);
            Add(k3, k1, 0);
          }
        }
        if (ch[i + 1][j] == '#') {
          if (ch[i][j + 1] == '#') {
            Add(k2, k4, 1);
            Add(k4, k2, 0);
          }
          if (ch[i][j - 1] == '#') {
            Add(k2, k3, 1);
            Add(k3, k2, 0);
          }
        }
      }
    }
  }
  while (bfs(S, T)) {
    mmax = mmax + dfs(S, T, INF);
  }
  cout << tot - (all - mmax);
  return 0;
}
