#include <bits/stdc++.h>
using namespace std;
const int N = 200 + 1, M = 20 * N * N, inf = 1e9;
int n, m;
bool a[N][N];
int t = 1;
int head[M], dest[M], nxt[M], c[M], f[M];
void add(int u, int v) {
  nxt[++t] = head[u];
  head[u] = t;
  dest[t] = v;
  c[t] = 1;
  f[t] = 0;
  nxt[++t] = head[v];
  head[v] = t;
  dest[t] = u;
  c[t] = 0;
  f[t] = 0;
}
bool check_v(int i, int j) {
  return i >= 0 && j >= 0 && i < n - 1 && j < m && a[i][j] && a[i + 1][j];
}
bool check_h(int i, int j) {
  return i >= 0 && j >= 0 && i < n && j < m - 1 && a[i][j] && a[i][j + 1];
}
int sz = 1;
map<pair<int, int>, int> mp[2];
int get(int i, int j, int k) {
  if (mp[k].find({i, j}) == mp[k].end()) mp[k][{i, j}] = sz++;
  return mp[k][{i, j}];
}
int level[M];
bool bfs() {
  for (int i = 0; i < sz; ++i) level[i] = -1;
  level[0] = 0;
  queue<int> q;
  q.push(0);
  while (!q.empty()) {
    int v = q.front();
    q.pop();
    for (int i = head[v]; i; i = nxt[i]) {
      if (c[i] - f[i] == 0) continue;
      int u = dest[i];
      if (level[u] == -1) {
        level[u] = level[v] + 1;
        q.push(u);
      }
    }
  }
  return level[sz - 1] != -1;
}
int ptr[M];
int dfs(int v, int flow = inf) {
  if (v == sz - 1) return flow;
  for (int& i = ptr[v]; i; i = nxt[i]) {
    int u = dest[i];
    if (level[u] != level[v] + 1 || c[i] - f[i] == 0) continue;
    int res = dfs(u, min(c[i] - f[i], flow));
    if (res) {
      f[i] += res;
      f[i ^ 1] -= res;
      return res;
    }
  }
  return 0;
}
int dinic() {
  int ans = 0;
  while (bfs()) {
    for (int i = 0; i < sz; ++i) ptr[i] = head[i];
    while (int res = dfs(0)) ans += res;
  }
  return ans;
}
int main() {
  ios_base::sync_with_stdio(false);
  cout.tie(0);
  cin.tie(0);
  cin >> n >> m;
  int cnt = 0;
  for (int i = 0; i < n; ++i)
    for (int j = 0; j < m; ++j) {
      char c;
      cin >> c;
      cnt += (a[i][j] = (c == '#'));
    }
  for (int i = 0; i < n - 1; ++i)
    for (int j = 0; j < m; ++j) {
      if (!check_v(i, j)) continue;
      if (check_h(i, j)) add(get(i, j, 0), get(i, j, 1));
      if (check_h(i, j - 1)) add(get(i, j, 0), get(i, j - 1, 1));
      if (check_h(i + 1, j)) add(get(i, j, 0), get(i + 1, j, 1));
      if (check_h(i + 1, j - 1)) add(get(i, j, 0), get(i + 1, j - 1, 1));
    }
  for (int i = 0; i < n - 1; ++i)
    for (int j = 0; j < m; ++j)
      if (check_v(i, j)) get(i, j, 0);
  for (int i = 0; i < n; ++i)
    for (int j = 0; j < m - 1; ++j)
      if (check_h(i, j)) get(i, j, 1);
  for (int i = 0; i < n - 1; ++i)
    for (int j = 0; j < m; ++j)
      if (check_v(i, j)) add(0, get(i, j, 0));
  for (int i = 0; i < n; ++i)
    for (int j = 0; j < m - 1; ++j)
      if (check_h(i, j)) add(get(i, j, 1), sz);
  ++sz;
  cout << cnt - (sz - 2 - dinic()) << "\n";
}
