#include <bits/stdc++.h>
using namespace std;
const int mod = 1e9 + 7;
const int maxn = 2e5 + 10;
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
struct edge {
  int to, flow, cap;
};
vector<edge> edges;
vector<int> adj[maxn];
void add_edge(int a, int b, int cap) {
  edge ab = {b, 0, cap};
  edge ba = {a, 0, 0};
  adj[a].push_back((int)edges.size());
  edges.push_back(ab);
  adj[b].push_back((int)edges.size());
  edges.push_back(ba);
}
int vis[maxn], ptr[maxn], level[maxn], s, t;
bool bfs() {
  queue<int> Q;
  Q.push(s);
  while (!Q.empty()) {
    int v = Q.front();
    Q.pop();
    for (int id : adj[v]) {
      edge e = edges[id];
      if (e.cap - e.flow < 1) {
        continue;
      }
      if (level[e.to] != -1) {
        continue;
      }
      level[e.to] = level[v] + 1;
      Q.push(e.to);
    }
  }
  return level[t] != -1;
}
int dfs(int v, int pushed) {
  if (pushed == 0) {
    return 0;
  }
  if (v == t) {
    return pushed;
  }
  for (int& j = ptr[v]; j < (int)adj[v].size(); j++) {
    edge e = edges[adj[v][j]];
    if (level[v] + 1 != level[e.to] || e.cap - e.flow < 1) {
      continue;
    }
    int tr = dfs(e.to, min(pushed, e.cap - e.flow));
    if (tr == 0) {
      continue;
    }
    edges[adj[v][j]].flow += tr;
    edges[adj[v][j] ^ 1].flow -= tr;
    return tr;
  }
  return 0;
}
int max_flow() {
  int flow = 0;
  while (true) {
    memset(level, -1, sizeof level);
    level[s] = 0;
    if (!bfs()) {
      break;
    }
    memset(ptr, 0, sizeof ptr);
    while (int pushed = dfs(s, mod)) {
      flow += pushed;
    }
  }
  return flow;
}
int n, m, grid[205][205];
int main() {
  ios_base::sync_with_stdio(false), cin.tie(0);
  cin >> n >> m;
  for (int i = 1; i <= n; i++) {
    for (int j = 1; j <= m; j++) {
      char c;
      cin >> c;
      grid[i][j] = (c == '#');
    }
  }
  int total = 0, total_vertices = 0;
  s = 400 * 400, t = s + 1;
  for (int i = 1; i <= n; i++) {
    for (int j = 1; j <= m; j++) {
      if (grid[i][j] == 1) {
        total++;
        int id1 = 0, id2 = 0, id3 = 0, id4 = 0;
        if (grid[i - 1][j] == 1) {
          id1 = 200 * (i - 1) + j;
        }
        if (grid[i][j + 1] == 1) {
          id2 = 200 * (202 + i) + j;
        }
        if (grid[i + 1][j] == 1) {
          id3 = 200 * i + j;
        }
        if (grid[i][j - 1] == 1) {
          id4 = 200 * (202 + i) + j - 1;
        }
        if (id1) {
          total_vertices++;
          add_edge(s, id1, 1);
        }
        if (id4) {
          total_vertices++;
          add_edge(id4, t, 1);
        }
        if (id1 && id2) {
          add_edge(id1, id2, 1);
        }
        if (id2 && id3) {
          add_edge(id3, id2, 1);
        }
        if (id3 && id4) {
          add_edge(id3, id4, 1);
        }
        if (id4 && id1) {
          add_edge(id1, id4, 1);
        }
      }
    }
  }
  int matching = max_flow();
  int ind_set = total_vertices - matching;
  cout << total - ind_set << "\n";
  return 0;
}
