#include <bits/stdc++.h>
using namespace std;
template <typename T>
void UMAX(T &a, T b) {
  a = (a > b ? a : b);
}
template <typename T>
void UMIN(T &a, T b) {
  a = (a < b ? a : b);
}
long long readint() {
  char c = getchar();
  long long ret = 0ll;
  bool neg = 0;
  while (!(c >= '0' && c <= '9')) {
    if (c == '-') neg = 1;
    c = getchar();
  }
  while (c >= '0' && c <= '9') {
    ret = ret * 10ll + (long long)(c - '0');
    c = getchar();
  }
  return neg ? -ret : ret;
}
void putint(long long v) {
  if (v < 0) {
    putchar('-');
    v = -v;
  }
  if (!v) {
    putchar('0');
    return;
  }
  if (v >= 10ll) putint(v / 10ll);
  putchar('0' + (v % 10ll));
}
const int S = 40002, T = 40003, inf = 50000;
namespace flows {
struct edge {
  int v, r, f;
  edge(int V, int R, int F) {
    v = V;
    r = R;
    f = F;
  }
};
vector<edge> adj[40005];
int cur[40005], dis[40005];
void init() {
  int i;
  for (i = 0; i < 40005; ++i) {
    adj[i].clear();
  }
}
void addedge(int u, int v, int f, bool bi = 0) {
  adj[u].push_back(edge(v, (int)adj[v].size(), f));
  adj[v].push_back(edge(u, (int)adj[u].size() - 1, bi ? f : 0));
}
void bfs() {
  queue<int> Q;
  Q.push(S);
  dis[S] = 0;
  while (!Q.empty()) {
    int i, cv = Q.front();
    Q.pop();
    for (i = 0; i < (int)adj[cv].size(); ++i) {
      if (adj[cv][i].f > 0 && dis[adj[cv][i].v] == -1) {
        dis[adj[cv][i].v] = dis[cv] + 1;
        Q.push(adj[cv][i].v);
      }
    }
  }
}
int dfs(int ver, int cap) {
  if (ver == T) return cap;
  for (int &i = cur[ver]; i < (int)adj[ver].size(); ++i) {
    edge &E = adj[ver][i];
    if (E.f > 0 && dis[E.v] > dis[ver]) {
      int ret = dfs(E.v, min(cap, E.f));
      if (ret > 0) {
        E.f -= ret;
        adj[E.v][E.r].f += ret;
        return ret;
      }
    }
  }
  return 0;
}
int maxflow() {
  int ret = 0, dlt;
  while (1) {
    memset(dis, -1, sizeof(dis));
    memset(cur, 0, sizeof(cur));
    bfs();
    if (dis[T] == -1) return ret;
    dlt = 1;
    while (dlt) {
      dlt = dfs(S, (int)1e9);
      ret += dlt;
    }
  }
}
}  // namespace flows
char g[205][205];
int n, m, a[205][205], cnt;
int main() {
  int i, j, k;
  n = readint() + 2;
  m = readint() + 2;
  for (i = 1; i < n - 1; ++i) {
    scanf("%s", g[i] + 1);
    for (j = 1; j < m - 1; ++j) {
      if (g[i][j] == '#') a[i][j] = cnt++;
    }
  }
  flows::init();
  for (i = 0; i < cnt; ++i) {
    flows::addedge(S, i, inf);
    flows::addedge(i, T, inf);
  }
  for (i = 0; i < n - 1; ++i) {
    for (j = 0; j < m; ++j) {
      if (g[i][j] == '#' && g[i + 1][j] == '#')
        flows::addedge(a[i][j], a[i + 1][j], 1, 1);
      else if (g[i][j] == '#')
        flows::addedge(S, a[i][j], 1);
      else if (g[i + 1][j] == '#')
        flows::addedge(S, a[i + 1][j], 1);
    }
  }
  for (i = 0; i < n; ++i) {
    for (j = 0; j < m - 1; ++j) {
      if (g[i][j] == '#' && g[i][j + 1] == '#')
        flows::addedge(a[i][j], a[i][j + 1], 1, 1);
      else if (g[i][j] == '#')
        flows::addedge(a[i][j], T, 1);
      else if (g[i][j + 1] == '#')
        flows::addedge(a[i][j + 1], T, 1);
    }
  }
  printf("%d\n", (flows::maxflow() - inf * cnt) / 2);
  return 0;
}
