#include <bits/stdc++.h>
using namespace std;
const int M = 200 + 5;
const int N = 2 * M * M;
char s[M];
int mp[M][M], id[M][M][2], idc0, idc1;
vector<int> g[N];
void adde(int u, int v) {
  if (u && v) g[u].push_back(v);
}
namespace hungrian {
int vis[N], link[N];
bool dfs(int u) {
  vis[u] = 1;
  for (int& v : g[u])
    if (!vis[link[v]]) {
      if (link[v] == 0 || dfs(link[v])) {
        link[v] = u;
        return true;
      }
    }
  return false;
}
int match(int nl, int nr) {
  fill_n(link + 1, nr, 0);
  int cnt = 0;
  for (int i = 1; i <= nl; i++) {
    fill_n(vis + 1, nl, 0);
    if (dfs(i)) cnt++;
  }
  return cnt;
}
};  // namespace hungrian
int main(void) {
  int n, m;
  scanf("%d%d", &n, &m);
  for (int i = 1; i <= n; i++) {
    scanf("%s", s + 1);
    for (int j = 1; j <= m; j++) mp[i][j] = (s[j] == '#');
  }
  for (int i = 1; i <= n; i++)
    for (int j = 1; j <= m; j++) {
      if (mp[i][j] && mp[i][j + 1]) id[i][j][0] = ++idc0;
      if (mp[i][j] && mp[i + 1][j]) id[i][j][1] = ++idc1;
    }
  for (int i = 1; i <= n; i++)
    for (int j = 1; j <= m; j++) {
      adde(id[i][j][0], id[i][j][1]);
      adde(id[i][j - 1][0], id[i][j][1]);
      adde(id[i][j][0], id[i - 1][j][1]);
      adde(id[i][j - 1][0], id[i - 1][j][1]);
    }
  int ans = 0;
  for (int i = 1; i <= n; i++)
    for (int j = 1; j <= m; j++) ans += mp[i][j];
  ans -= idc0 + idc1 - hungrian::match(idc0, idc1);
  printf("%d\n", ans);
}
