#include <bits/stdc++.h>
using namespace std;
string q(int x) { return to_string(x / 1000) + " " + to_string(x % 1000); }
struct kuhn {
  int n, m, t;
  int *f, *b, *w;
  vector<int> *g;
  kuhn(int _n, int _m)
      : n(_n),
        m(_m),
        t(1),
        f(new int[n]),
        b(new int[m]),
        w(new int[n]),
        g(new vector<int>[n]) {
    fill_n(f, n, -1);
    fill_n(b, m, -1);
  }
  void edge(int v, int u) {
    assert(0 <= v && v < n);
    assert(0 <= u && u < m);
    g[v].push_back(u);
  }
  bool dfs(int v) {
    if (w[v] == t) {
      return false;
    }
    w[v] = t;
    for (int u : g[v]) {
      if (b[u] == -1) {
        f[v] = u;
        b[u] = v;
        return true;
      }
    }
    for (int u : g[v]) {
      if (dfs(b[u])) {
        f[v] = u;
        b[u] = v;
        return true;
      }
    }
    return false;
  }
  int run() {
    int sz = 0;
    for (bool flag = true; flag; ++t) {
      flag = false;
      for (int i = 0; i < n; ++i) {
        if (f[i] == -1 && dfs(i)) {
          ++sz;
          flag = true;
        }
      }
    }
    return sz;
  }
} solver((int)1e6, (int)1e6);
const int N = 1000;
const int D = 0;
const int R = 1;
const int dx[4] = {-1, 0, +1, 0};
const int dy[4] = {0, -1, 0, +1};
int n;
int m;
char arr[N][N];
int id(int a, int b, int c, int d) {
  if (make_pair(a, b) > make_pair(c, d)) {
    swap(a, c);
    swap(b, d);
  }
  if (c == a + 1) {
    assert(d == b);
    return 2 * N * a + 2 * b;
  } else {
    assert(d == b + 1);
    return 2 * N * a + 2 * b + 1;
  }
}
bool gg(int i, int j) {
  return 0 <= i && i < n && 0 <= j && j < m && arr[i][j] == '#';
}
void check(int a, int b, int c, int d, int e, int f) {
  if (!gg(a, b) || !gg(c, d) || !gg(e, f)) {
    return;
  }
  int v = id(a, b, c, d), u = id(a, b, e, f);
  assert(v % 2 != u % 2);
  if (v % 2 > u % 2) {
    swap(v, u);
  }
  solver.edge(v / 2, u / 2);
}
int32_t main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cin >> n >> m;
  int cnt = 0;
  int tot = 0;
  for (int i = 0; i < n; ++i) {
    cin >> arr[i];
  }
  for (int i = 0; i < n; ++i) {
    for (int j = 0; j < m; ++j) {
      tot += gg(i, j);
      cnt += gg(i, j) && gg(i + 1, j);
      cnt += gg(i, j) && gg(i, j + 1);
    }
  }
  for (int i = 0; i < n; ++i) {
    for (int j = 0; j < m; ++j) {
      for (int a = 0; a < 4; ++a) {
        int b = (a + 1) % 4;
        check(i, j, i + dx[a], j + dy[a], i + dx[b], j + dy[b]);
      }
    }
  }
  cout << tot - (cnt - solver.run()) << endl;
  return 0;
}
