#include <bits/stdc++.h>
using namespace std;
char s[400][400];
int a, b, k, sum, opt, f1[400][400], f2[400][400];
namespace sub {
const int N = 3e6 + 7;
struct edge {
  int u, v, q, t;
} ed[N];
int n, m, s, t, ans, tot, f[N], cur[N], gap[N], dis[N];
inline void addedge(int u, int v, int q) {
  if (u == 0 || v == 0) return;
  tot++, ed[tot].u = u, ed[tot].v = v, ed[tot].q = q, ed[tot].t = f[u],
         f[u] = tot;
}
inline int addflow(int u, int v) {
  if (u == t) return v;
  int op = 0, rt = 0;
  for (int x = cur[u]; x > 0; x = ed[x].t) {
    cur[u] = x;
    if (dis[ed[x].v] + 1 == dis[u] && ed[x].q) {
      rt = addflow(ed[x].v, min(v - op, ed[x].q)), op += rt;
      ed[x].q -= rt, ed[x ^ 1].q += rt;
      if (op == v) return op;
    }
  }
  if (!(--gap[dis[u]++])) dis[s] = n + 1;
  gap[dis[u]]++, cur[u] = f[u];
  return op;
}
void main() {
  s = 1, t = n;
  for (int i = 1; i <= n; i++) cur[i] = f[i];
  while (dis[s] <= n) ans += addflow(s, 0x7ffffff);
  cout << sum + ans - opt << endl;
}
}  // namespace sub
int main() {
  cin >> a >> b;
  sub::tot = 1;
  for (int i = 1; i <= a; i++) scanf("%s", s[i] + 1);
  k = 1;
  for (int i = 1; i <= a; i++)
    for (int j = 1; j <= b; j++)
      if (s[i][j] == '#') sum++;
  for (int i = 1; i <= a; i++)
    for (int j = 1; j < b; j++)
      if (s[i][j] == '#' && s[i][j + 1] == '#') f1[i][j] = ++k, opt++;
  for (int i = 1; i < a; i++)
    for (int j = 1; j <= b; j++)
      if (s[i][j] == '#' && s[i + 1][j] == '#') f2[i][j] = ++k, opt++;
  sub::n = k + 1;
  k++;
  for (int i = 1; i <= a; i++)
    for (int j = 1; j < b; j++)
      sub::addedge(1, f1[i][j], 1), sub::addedge(f1[i][j], 1, 0);
  for (int i = 1; i < a; i++)
    for (int j = 1; j <= b; j++)
      sub::addedge(f2[i][j], k, 1), sub::addedge(k, f2[i][j], 0);
  for (int i = 1; i <= a; i++)
    for (int j = 1; j <= b; j++) {
      int s1 = 0, s2 = 0;
      if (f1[i][j]) s1++;
      if (f1[i][j - 1]) s1++;
      if (f2[i][j]) s2++;
      if (f2[i - 1][j]) s2++;
      sub::addedge(f1[i][j], f2[i][j], 100000);
      sub::addedge(f2[i][j], f1[i][j], 0);
      sub::addedge(f1[i][j - 1], f2[i][j], 100000);
      sub::addedge(f2[i][j], f1[i][j - 1], 0);
      sub::addedge(f1[i][j], f2[i - 1][j], 100000);
      sub::addedge(f2[i - 1][j], f1[i][j], 0);
      sub::addedge(f1[i][j - 1], f2[i - 1][j], 100000);
      sub::addedge(f2[i - 1][j], f1[i][j - 1], 0);
    }
  sub::main();
  return 0;
}
