#include <bits/stdc++.h>
using namespace std;
const int maxn = 210, maxn2 = maxn * maxn * 2, mod = 1e9 + 7, inf = 1e9 + 10;
string s[maxn];
template <typename T, T inf, int MAXN>
struct Flow {
  vector<pair<int, T> > v[MAXN];
  vector<int> idv[MAXN];
  int h[MAXN], arr[MAXN], pt[MAXN];
  T lim;
  bool bfs(int Source, int Sink) {
    memset(h, 0, sizeof h);
    int L = 0, R = 0;
    arr[R++] = Source;
    h[Source] = 1;
    while (L < R) {
      int u = arr[L++];
      if (u == Sink) return 1;
      for (pair<int, T> p : v[u]) {
        if (p.second >= lim && h[p.first] == 0)
          h[p.first] = h[u] + 1, arr[R++] = p.first;
      }
    }
    return 0;
  }
  T dfs(int u, int Sink, T flow) {
    if (u == Sink) return flow;
    T ans = 0;
    while (pt[u] < int((v[u]).size())) {
      int &y = v[u][pt[u]].first;
      T &w = v[u][pt[u]].second, &w2 = v[y][idv[u][pt[u]]].second;
      if (h[u] + 1 == h[y] && w >= lim) {
        T num = dfs(y, Sink, min(flow - ans, w));
        ans += num;
        w -= num;
        w2 += num;
      }
      if (flow == ans) break;
      ++pt[u];
    }
    return ans;
  }
  void add_edge(int a, int b, T wa, T wb = 0) {
    idv[a].push_back(int((v[b]).size()));
    idv[b].push_back(int((v[a]).size()));
    v[a].push_back({b, wa});
    v[b].push_back({a, wb});
  }
  T flow(int Source, int Sink, int MXB = 0) {
    T ans = 0;
    for (int i = MXB; i >= 0; i--) {
      lim = (1ll << i);
      while (bfs(Source, Sink)) {
        memset(pt, 0, sizeof pt);
        ans += dfs(Source, Sink, inf);
      }
    }
    return ans;
  }
};
Flow<long long, 1000000000000000000, maxn * maxn * 2> flw;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie();
  int n, m;
  cin >> n >> m;
  for (int i = 0; i < n; i++) {
    cin >> s[i];
  }
  auto to = [&](int i, int j) { return i * m + j; };
  int second = n * m;
  int TOT = 0, TOT2 = 0, SRC = n * m * 2, SNK = SRC + 1;
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < m; j++) {
      int L = -1, R = -1, U = -1, D = -1;
      if (j > 0 && s[i][j] == '#' && s[i][j - 1] == '#') L = to(i, j);
      if (j < m - 1 && s[i][j] == '#' && s[i][j + 1] == '#') R = to(i, j + 1);
      if (i > 0 && s[i][j] == '#' && s[i - 1][j] == '#') U = second + to(i, j);
      if (i < n - 1 && s[i][j] == '#' && s[i + 1][j] == '#')
        D = second + to(i + 1, j);
      if (L != -1 && U != -1) flw.add_edge(L, U, 1);
      if (U != -1 && R != -1) flw.add_edge(R, U, 1);
      if (R != -1 && D != -1) flw.add_edge(R, D, 1);
      if (D != -1 && L != -1) flw.add_edge(L, D, 1);
      if (L != -1) flw.add_edge(SRC, L, 1), TOT++;
      if (U != -1) flw.add_edge(U, SNK, 1), TOT++;
      if (s[i][j] == '#') TOT2++;
    }
  }
  return cout << TOT2 - TOT + flw.flow(SRC, SNK) << endl, 0;
}
