#include <bits/stdc++.h>
using namespace std;
const int MAX_N = 201;
struct Edge {
  int v, u;
  long long cap, flow = 0;
  Edge(int v, int u, long long cap) : v(v), u(u), cap(cap) {}
};
class Dinic {
  const long long flow_inf = 1e18;
  vector<Edge> edges;
  vector<vector<int>> adj;
  int n, m = 0;
  int second, t;
  vector<int> level, ptr;
  queue<int> q;
  bool bfs() {
    fill(level.begin(), level.end(), -1);
    level[second] = 0, q.push(second);
    while (!q.empty()) {
      int v = q.front();
      q.pop();
      for (int id : adj[v]) {
        if (edges[id].cap - edges[id].flow < 1) continue;
        if (level[edges[id].u] != -1) continue;
        level[edges[id].u] = level[v] + 1;
        q.push(edges[id].u);
      }
    }
    return level[t] != -1;
  }
  long long dfs(int v, long long pushed) {
    if (v == t || !pushed) return pushed;
    for (int& cid = ptr[v]; cid < (int)adj[v].size(); cid++) {
      int id = adj[v][cid], u = edges[id].u;
      if (level[v] + 1 != level[u] || edges[id].cap - edges[id].flow < 1)
        continue;
      long long tr = dfs(u, min(pushed, edges[id].cap - edges[id].flow));
      if (tr == 0) continue;
      edges[id].flow += tr, edges[id ^ 1].flow -= tr;
      return tr;
    }
    return 0;
  }

 public:
  Dinic(int n, int second, int t) : n(n), second(second), t(t) {
    adj.resize(n);
    level.resize(n);
    ptr.resize(n);
  }
  void add_edge(int v, int u, long long cap) {
    edges.emplace_back(v, u, cap);
    edges.emplace_back(u, v, 0);
    adj[v].push_back(m);
    adj[u].push_back(m + 1);
    m += 2;
  }
  long long flow() {
    long long first = 0;
    while (bfs()) {
      fill(ptr.begin(), ptr.end(), 0);
      while (long long pushed = dfs(second, flow_inf)) first += pushed;
    }
    return first;
  }
};
int n, m;
char field[MAX_N][MAX_N];
int main(int argc, const char* argv[]) {
  cin >> n >> m;
  Dinic dinic(n * m * 2 + 2, 2 * n * m, 2 * n * m + 1);
  for (int i = (0); i < (n); i++)
    for (int j = (0); j < (m); j++) cin >> field[i][j];
  int num = 0;
  for (int i = (0); i < (n); i++)
    for (int j = (0); j < (m); j++) {
      if (!(field[(i)][(j)] == '#')) continue;
      num++;
      if (i != n - 1)
        if ((field[(i + 1)][(j)] == '#'))
          dinic.add_edge(2 * n * m, 2 * m * (i) + 2 * (j) + 1, 1), num--;
      if (j != m - 1)
        if ((field[(i)][(j + 1)] == '#'))
          dinic.add_edge(2 * m * (i) + 2 * (j), 2 * n * m + 1, 1), num--;
      if (i && j)
        if ((field[(i - 1)][(j)] == '#') && (field[(i)][(j - 1)] == '#'))
          dinic.add_edge(2 * m * (i - 1) + 2 * (j) + 1,
                         2 * m * (i) + 2 * (j - 1), 1);
      if (i != n - 1 && j)
        if ((field[(i + 1)][(j)] == '#') && (field[(i)][(j - 1)] == '#'))
          dinic.add_edge(2 * m * (i) + 2 * (j) + 1, 2 * m * (i) + 2 * (j - 1),
                         1);
      if (i && j != m - 1)
        if ((field[(i - 1)][(j)] == '#') && (field[(i)][(j + 1)] == '#'))
          dinic.add_edge(2 * m * (i - 1) + 2 * (j) + 1, 2 * m * (i) + 2 * (j),
                         1);
      if (i != n - 1 && j != m - 1)
        if ((field[(i + 1)][(j)] == '#') && (field[(i)][(j + 1)] == '#'))
          dinic.add_edge(2 * m * (i) + 2 * (j) + 1, 2 * m * (i) + 2 * (j), 1);
    }
  cout << num + dinic.flow() << endl;
  return 0;
}
