#include <bits/stdc++.h>
using namespace std;
const int INF = 0x3f3f3f3f;
const long long LINF = 0x3f3f3f3f3f3f3f3fll;
mt19937 rng((int)chrono::steady_clock::now().time_since_epoch().count());
struct kuhn {
  int n, m;
  vector<vector<int>> g;
  vector<int> vis, ma, mb;
  kuhn(int n_, int m_) : n(n_), m(m_), g(n), vis(n + m), ma(n, -1), mb(m, -1) {}
  void add(int a, int b) { g[a].push_back(b); }
  bool dfs(int i) {
    vis[i] = 1;
    for (int j : g[i])
      if (!vis[n + j]) {
        vis[n + j] = 1;
        if (mb[j] == -1 or dfs(mb[j])) {
          ma[i] = j, mb[j] = i;
          return true;
        }
      }
    return false;
  }
  int matching() {
    int ret = 0, aum = 1;
    for (auto& i : g) shuffle(i.begin(), i.end(), rng);
    while (aum) {
      for (int j = 0; j < m; j++) vis[n + j] = 0;
      aum = 0;
      for (int i = 0; i < n; i++)
        if (ma[i] == -1 and dfs(i)) ret++, aum = 1;
    }
    return ret;
  }
};
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  int n, m;
  cin >> n >> m;
  vector<string> v(n);
  for (auto& i : v) cin >> i;
  vector<string> v2;
  kuhn k((n - 1) * m, (m - 1) * n);
  int vert = 0, qt = 0;
  for (int i = 0; i < n; i++)
    for (int j = 0; j < m; j++)
      if (v[i][j] == '#') {
        qt++;
        if (i + 1 < n and v[i + 1][j] == '#') {
          vert++;
          if (j + 1 < m and v[i][j + 1] == '#') k.add(m * i + j, n * j + i);
          if (j + 1 < m and v[i + 1][j + 1] == '#')
            k.add(m * i + j, n * j + i + 1);
          if (j and v[i][j - 1] == '#') k.add(m * i + j, n * (j - 1) + i);
          if (j and v[i + 1][j - 1] == '#')
            k.add(m * i + j, n * (j - 1) + i + 1);
        }
        if (j + 1 < m and v[i][j + 1] == '#') vert++;
      }
  cout << qt - (vert - k.matching()) << '\n';
  exit(0);
}
