#include <bits/stdc++.h>
using namespace std;
const int maxn = 305, MAXN = 2 * 305 * 305, inf = 0x3f3f3f3f, mod = 1000000007;
const long long INF = 0x3f3f3f3f3f3f3f3f;
const double eps = 1e-9;
void read() {}
template <typename T, typename... T2>
inline void read(T& x, T2&... oth) {
  x = 0;
  int ch = getchar(), f = 0;
  while (ch < '0' || ch > '9') {
    if (ch == '-') f = 1;
    ch = getchar();
  }
  while (ch >= '0' && ch <= '9') {
    x = (x << 1) + (x << 3) + (ch ^ 48);
    ch = getchar();
  }
  if (f) x = -x;
  read(oth...);
}
struct Dinic {
  struct Edge {
    int from, to, cap, flow;
    Edge(int u, int v, int c, int f) : from(u), to(v), cap(c), flow(f) {}
  };
  int n, m, s, t;
  vector<Edge> edges;
  vector<int> G[MAXN];
  bool vis[MAXN];
  int d[MAXN];
  int cur[MAXN];
  void init(int n) {
    this->n = n;
    for (int i = 0; i < n; i++) G[i].clear();
    edges.clear();
  }
  void AddEdge(int from, int to, int cap) {
    edges.push_back(Edge(from, to, cap, 0));
    edges.push_back(Edge(to, from, 0, 0));
    m = edges.size();
    G[from].push_back(m - 2);
    G[to].push_back(m - 1);
  }
  bool BFS() {
    memset(vis, 0, sizeof(vis));
    queue<int> q;
    q.push(s);
    d[s] = 0;
    vis[s] = 1;
    while (!q.empty()) {
      int x = q.front();
      q.pop();
      for (int i = 0; i < G[x].size(); i++) {
        Edge& e = edges[G[x][i]];
        if (!vis[e.to] && e.cap > e.flow) {
          vis[e.to] = 1;
          d[e.to] = d[x] + 1;
          q.push(e.to);
        }
      }
    }
    return vis[t];
  }
  int DFS(int x, int a) {
    if (x == t || a == 0) return a;
    int flow = 0, f;
    for (int& i = cur[x]; i < G[x].size(); i++) {
      Edge& e = edges[G[x][i]];
      if (d[x] + 1 == d[e.to] && (f = DFS(e.to, min(a, e.cap - e.flow))) > 0) {
        e.flow += f;
        edges[G[x][i] ^ 1].flow -= f;
        flow += f;
        a -= f;
        if (a == 0) break;
      }
    }
    if (!flow) d[x] = -1;
    return flow;
  }
  int Maxflow(int s, int t) {
    this->s = s, this->t = t;
    int flow = 0;
    while (BFS()) {
      memset(cur, 0, sizeof(cur));
      flow += DFS(s, inf);
    }
    return flow;
  }
} di;
char s[maxn][maxn];
signed main(signed argc, char const* argv[]) {
  std::ios::sync_with_stdio(false), cin.tie(0), cout.tie(0);
  int n, m, tot = 0, node = 0;
  cin >> n >> m;
  int st = 2 * n * m + 1, ed = 2 * n * m + 2;
  di.init(ed + 5);
  auto w = [&](int x, int y) { return m * (x - 1) + y; };
  auto h = [&](int x, int y) { return (n - 1) * m + n * (y - 1) + x; };
  for (int i = 1; i <= n; i++) {
    cin >> s[i] + 1;
    for (int j = 1; j <= m; j++) {
      if (s[i][j] == '#') {
        tot++;
        if (i > 1 && s[i - 1][j] == '#') di.AddEdge(st, w(i - 1, j), 1), node++;
        if (j > 1 && s[i][j - 1] == '#') di.AddEdge(h(i, j - 1), ed, 1), node++;
      }
    }
  }
  for (int i = 1; i <= n; i++) {
    for (int j = 1; j <= m; j++) {
      if (s[i][j] == '#') {
        if (i < n && j < m && s[i + 1][j] == '#' && s[i][j + 1] == '#')
          di.AddEdge(w(i, j), h(i, j), 1);
        if (i > 1 && j < m && s[i - 1][j] == '#' && s[i][j + 1] == '#')
          di.AddEdge(w(i - 1, j), h(i, j), 1);
        if (i < n && j > 1 && s[i + 1][j] == '#' && s[i][j - 1] == '#')
          di.AddEdge(w(i, j), h(i, j - 1), 1);
        if (i > 1 && j > 1 && s[i - 1][j] == '#' && s[i][j - 1] == '#')
          di.AddEdge(w(i - 1, j), h(i, j - 1), 1);
      }
    }
  }
  cout << tot - (node - di.Maxflow(st, ed)) << endl;
  return 0;
}
