#include <bits/stdc++.h>
using ll = long long;
using namespace std;
using namespace std::chrono;
int n, m;
int const N = 203;
int ans;
char s[N][N];
int cnt = 0;
vector<int> U;
vector<int> V;
vector<int> D[2 * N * N];
map<pair<int, int>, int> num;
int match[2 * N * N];
queue<int> bffs;
bool visited_bfs[2 * N * N];
int dist[2 * N * N];
int const INF = 1e9 + 2;
int NIL = 2 * N * N - 1;
int ret = 0;
bool bfs() {
  for (const auto& u : U) {
    if (match[u] == NIL) {
      dist[u] = 0;
      bffs.push(u);
    } else {
      dist[u] = INF;
    }
  }
  dist[NIL] = INF;
  while (!bffs.empty()) {
    int u = bffs.front();
    bffs.pop();
    if (dist[u] < dist[NIL]) {
      for (const auto& v : D[u]) {
        if (dist[match[v]] == INF) {
          dist[match[v]] = dist[u] + 1;
          bffs.push(match[v]);
        }
      }
    }
  }
  return dist[NIL] != INF;
}
bool dfs(int u) {
  if (u != NIL) {
    for (const auto& v : D[u]) {
      if (dist[match[v]] == dist[u] + 1) {
        if (dfs(match[v]) == true) {
          match[v] = u;
          match[u] = v;
          return true;
        }
      }
    }
    dist[u] = INF;
    return false;
  }
  return true;
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cin >> n >> m;
  for (int i = (0); i <= (n - 1); i++) cin >> s[i];
  for (int i = (0); i <= (n - 1); i++) {
    for (int j = (0); j <= (m - 1); j++) {
      if (s[i][j] == '#') {
        ans++;
        if (j + 1 < m && s[i][j + 1] == '#') {
          num[make_pair(2 * i, 2 * j + 1)] = ++cnt;
          U.push_back(cnt);
        }
        if (i + 1 < n && s[i + 1][j] == '#') {
          num[make_pair(2 * i + 1, 2 * j)] = ++cnt;
          V.push_back(cnt);
        }
        if (i > 0 && s[i - 1][j] == '#' && j > 0 && s[i][j - 1] == '#') {
          D[num[make_pair(2 * i - 1, 2 * j)]].push_back(
              num[make_pair(2 * i, 2 * j - 1)]);
          D[num[make_pair(2 * i, 2 * j - 1)]].push_back(
              num[make_pair(2 * i - 1, 2 * j)]);
        }
        if (i + 1 < n && s[i + 1][j] == '#' && j > 0 && s[i][j - 1] == '#') {
          D[num[make_pair(2 * i + 1, 2 * j)]].push_back(
              num[make_pair(2 * i, 2 * j - 1)]);
          D[num[make_pair(2 * i, 2 * j - 1)]].push_back(
              num[make_pair(2 * i + 1, 2 * j)]);
        }
        if (i > 0 && s[i - 1][j] == '#' && j + 1 < m && s[i][j + 1] == '#') {
          D[num[make_pair(2 * i - 1, 2 * j)]].push_back(
              num[make_pair(2 * i, 2 * j + 1)]);
          D[num[make_pair(2 * i, 2 * j + 1)]].push_back(
              num[make_pair(2 * i - 1, 2 * j)]);
        }
        if (i + 1 < n && s[i + 1][j] == '#' && j + 1 < m &&
            s[i][j + 1] == '#') {
          D[num[make_pair(2 * i + 1, 2 * j)]].push_back(
              num[make_pair(2 * i, 2 * j + 1)]);
          D[num[make_pair(2 * i, 2 * j + 1)]].push_back(
              num[make_pair(2 * i + 1, 2 * j)]);
        }
      }
    }
  }
  for (int i = (1); i <= (cnt); i++) match[i] = NIL;
  while (bfs()) {
    for (const auto& u : U) {
      if (match[u] == NIL) {
        ret += (dfs(u)) ? 1 : 0;
      }
    }
  }
  cout << ans - (cnt - ret) << endl;
  return 0;
}
