#include <bits/stdc++.h>
using namespace std;
char mp[300][300];
int n, m, tot, id[300][300], inf, S, T, ans;
int head[2001000], cnt = 2, dis[2001000], cur[2001000];
struct note {
  int to, nxt, sz;
} a[2001000];
void add(int x, int y, int z) {
  a[cnt].to = y;
  a[cnt].sz = z;
  a[cnt].nxt = head[x];
  head[x] = cnt++;
  a[cnt].to = x;
  a[cnt].sz = 0;
  a[cnt].nxt = head[y];
  head[y] = cnt++;
}
queue<int> q;
bool bfs() {
  int i;
  for (i = 0; i <= T; i++) dis[i] = 0;
  while (!q.empty()) q.pop();
  q.push(S);
  dis[S] = 1;
  while (!q.empty()) {
    int now = q.front();
    q.pop();
    for (i = head[now]; i; i = a[i].nxt) {
      int to = a[i].to;
      if (dis[to] == 0 && a[i].sz) {
        dis[to] = dis[now] + 1;
        if (to == T) {
          return true;
        }
        q.push(to);
      }
    }
  }
  if (dis[T] != 0) return true;
  return false;
}
int dinic(int x, int flow) {
  int i, sum = 0;
  if (x == T || flow == 0) return flow;
  for (i = cur[x]; i; i = a[i].nxt) {
    cur[x] = i;
    int to = a[i].to;
    if (dis[to] == dis[x] + 1 && a[i].sz > 0) {
      int f = dinic(to, min(flow - sum, a[i].sz));
      if (!f) continue;
      a[i].sz -= f;
      a[i ^ 1].sz += f;
      sum += f;
      if (sum == flow) break;
    }
  }
  if (sum == 0) dis[x] = 0;
  return sum;
}
int Id(int x, int y, int z) { return (x - 1) * m + y + z; }
int main() {
  int i, j, js, L, R, U, D;
  scanf("%d%d", &n, &m);
  for (i = 1; i <= n; i++) {
    scanf("%s", mp[i] + 1);
  }
  S = 2 * n * m + 5, T = S + 1;
  for (i = 1; i <= n; i++) {
    for (j = 1; j <= m; j++)
      if (mp[i][j] == '#') {
        L = (j > 1 && mp[i][j - 1] == '#') ? Id(i, j - 1, 0) : 0;
        R = (j < m && mp[i][j + 1] == '#') ? Id(i, j - 1, 1) : 0;
        U = (i > 1 && mp[i - 1][j] == '#') ? Id(i - 1, j, n * m) : 0;
        D = (i < n && mp[i + 1][j] == '#') ? Id(i - 1, j, n * m + m) : 0;
        if (L && U) add(L, U, 1);
        if (L && D) add(L, D, 1);
        if (R && U) add(R, U, 1);
        if (R && D) add(R, D, 1);
      }
  }
  int sum = 0, res = 0;
  for (i = 1; i <= n; i++)
    for (j = 1; j <= m; j++)
      if (mp[i][j] == '#') {
        sum++;
        if (j < m && mp[i][j + 1] == '#') add(S, Id(i, j - 1, 1), 1), res++;
        if (i + 1 <= n && mp[i + 1][j] == '#')
          add(Id(i - 1, j, n * m + m), T, 1), res++;
      }
  while (bfs()) {
    for (i = 0; i <= T; i++) cur[i] = head[i];
    ans += dinic(S, 1e9);
  }
  printf("%d\n", sum - res + ans);
  return 0;
}
