#include <bits/stdc++.h>
const int N = 80010;
const int M = N << 2;
using namespace std;
int n, m;
int head[N], nxt[M << 1], v[M << 1], w[M << 1], cnt = 1;
void addedge(int x, int y, int fw) {
  nxt[++cnt] = head[x];
  head[x] = cnt;
  v[cnt] = y;
  w[cnt] = fw;
  nxt[++cnt] = head[y];
  head[y] = cnt;
  v[cnt] = x;
  w[cnt] = 0;
}
int S, T, used[N], d[N], cur[N], num[N], p[N], flag, maxflow;
void bfs() {
  queue<int> q;
  q.push(T);
  used[T] = 1;
  d[T] = 0;
  while (!q.empty()) {
    int u = q.front();
    q.pop();
    for (int i = head[u]; i; i = nxt[i]) {
      if (!used[v[i]]) {
        d[v[i]] = d[u] + 1;
        used[v[i]] = 1;
        q.push(v[i]);
      }
    }
  }
  return;
}
int agument() {
  int x = T, mi = 0x3f3f3f3f;
  while (x != S) {
    int i = p[x];
    mi = min(mi, w[i]);
    x = v[i ^ 1];
  }
  x = T;
  while (x != S) {
    int i = p[x];
    w[i] -= mi;
    w[i ^ 1] += mi;
    x = v[i ^ 1];
  }
  return mi;
}
int isap() {
  bfs();
  for (int i = 0; i <= T; ++i) num[d[i]]++;
  for (int i = 0; i <= T; ++i) cur[i] = head[i];
  int now = S;
  while (d[S] < T) {
    if (now == T) {
      maxflow += agument();
      now = S;
    }
    flag = 0;
    for (int i = cur[now]; i; i = nxt[i]) {
      if (w[i] && d[now] == d[v[i]] + 1) {
        flag = 1;
        p[v[i]] = i;
        cur[now] = i;
        now = v[i];
        break;
      }
    }
    if (!flag) {
      int mm = T - 1;
      for (int i = head[now]; i; i = nxt[i]) {
        if (w[i]) mm = min(mm, d[v[i]]);
      }
      num[d[now]]--;
      if (num[d[now]] == 0) d[S] = T;
      d[now] = mm + 1;
      num[d[now]]++;
      cur[now] = head[now];
      if (now != S) now = v[p[now] ^ 1];
    }
  }
  return maxflow;
}
int sum, ct, vis[N];
char ss[202][202];
int main() {
  scanf("%d%d", &n, &m);
  for (int i = 1; i <= n; i++) scanf("%s", ss[i] + 1);
  S = 0;
  T = n * m * 2 + 1;
  for (int i = 1; i <= n; i++)
    for (int j = 1; j <= m; j++)
      if (ss[i][j] == '#') {
        sum++;
        int uu = (i - 1) * m + j, rr = uu + n * m, dd = i * m + j, ll = rr - 1;
        if (ss[i - 1][j] == '#' && !vis[uu])
          ++ct, vis[uu] = 1, addedge(S, uu, 1);
        if (ss[i][j - 1] == '#' && !vis[ll])
          ++ct, vis[ll] = 1, addedge(ll, T, 1);
        if (ss[i - 1][j] == '#') {
          if (ss[i][j + 1] == '#') addedge(uu, rr, 1);
          if (ss[i][j - 1] == '#') addedge(uu, ll, 1);
        }
        if (ss[i + 1][j] == '#') {
          if (ss[i][j + 1] == '#') addedge(dd, rr, 1);
          if (ss[i][j - 1] == '#') addedge(dd, ll, 1);
        }
      }
  printf("%d", sum - (ct - isap()));
  return 0;
}
