#include <bits/stdc++.h>
using namespace std;
map<int, int> G[800100];
struct FlowEdge {
  int v, u;
  long long cap, flow = 0;
  FlowEdge(int v, int u, long long cap) : v(v), u(u), cap(cap) {}
};
struct Dinic {
  const long long flow_inf = 1e18;
  vector<FlowEdge> edges;
  vector<vector<int>> adj;
  int n, m = 0;
  int s, t;
  vector<int> level, ptr;
  queue<int> q;
  Dinic(int n, int s, int t) : n(n), s(s), 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;
  }
  bool bfs() {
    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 (pushed == 0) return 0;
    if (v == t) return pushed;
    for (int &cid = ptr[v]; cid < (int)adj[v].size(); cid++) {
      int id = adj[v][cid];
      int 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;
  }
  long long flow() {
    long long f = 0;
    while (true) {
      fill(level.begin(), level.end(), -1);
      level[s] = 0;
      q.push(s);
      if (!bfs()) break;
      fill(ptr.begin(), ptr.end(), 0);
      while (long long pushed = dfs(s, flow_inf)) {
        f += pushed;
      }
    }
    return f;
  }
};
map<pair<pair<int, int>, pair<int, int>>, int> mnodes;
int auxnodes = 0;
int getNode(pair<pair<int, int>, pair<int, int>> &x, Dinic *dinic = NULL) {
  if (x.first > x.second) swap(x.first, x.second);
  if (mnodes.count(x)) return mnodes[x];
  if (dinic) {
    if (x.first.first == x.second.first)
      dinic->add_edge(800090, auxnodes, 1);
    else
      assert(x.first.second == x.second.second),
          dinic->add_edge(auxnodes, 800080, 1);
  }
  return mnodes[x] = auxnodes++;
}
int color[800100];
void dfs(int node, int clr) {
  color[node] = clr;
  for (auto it = G[node].begin(); it != G[node].end(); it++)
    if (color[it->first] == -1)
      dfs(it->first, 1 - clr);
    else
      assert(color[it->first] != clr);
}
int main() {
  ios::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  int n, m, dr[4] = {-1, 0, 1, 0}, dc[4] = {0, -1, 0, 1}, black = 0;
  char table[201][201];
  cin >> n >> m;
  for (int i = (0); i < (n); i++)
    for (int j = (0); j < (m); j++) cin >> table[i][j];
  vector<pair<int, int>> auxv(4);
  Dinic dinic(800100, 800090, 800080);
  for (int i = (0); i < (n); i++)
    for (int j = (0); j < (m); j++)
      if (table[i][j] == '#') {
        black++;
        for (int k = (0); k < (4); k++) {
          int r = i + dr[k], c = j + dc[k];
          if (r < 0 || c < 0 || r == n || c == m || table[r][c] != '#')
            auxv[k] = make_pair(-1, -1);
          else
            auxv[k] = make_pair(r, c);
        }
        pair<int, int> curp = make_pair(i, j);
        for (int k = (0); k < (4); k++)
          if (auxv[k].first != -1 && auxv[(k + 1) % 4].first != -1) {
            pair<pair<int, int>, pair<int, int>> a = make_pair(curp, auxv[k]),
                                                 b = make_pair(
                                                     curp, auxv[(k + 1) % 4]);
            int nodea = getNode(a, &dinic), nodeb = getNode(b, &dinic);
            if (a.first.first == a.second.first)
              dinic.add_edge(nodea, nodeb, 1);
            else
              dinic.add_edge(nodeb, nodea, 1);
          }
      }
  assert(auxnodes < 800080);
  long long ans = black + dinic.flow();
  for (int i = (0); i < (n); i++)
    for (int j = (0); j < (m); j++)
      if (table[i][j] == '#')
        for (int k = (0); k < (4); k++) {
          int r = i + dr[k], c = j + dc[k];
          if (r < 0 || c < 0 || r == n || c == m || table[r][c] != '#')
            continue;
          pair<pair<int, int>, pair<int, int>> x =
              make_pair(make_pair(i, j), make_pair(r, c));
          getNode(x);
        }
  assert(auxnodes < 800080);
  cout << ans - auxnodes << '\n';
  return 0;
}
