#include <bits/stdc++.h>
using namespace std;
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
inline long long rand(long long x, long long y) {
  return rng() % (y + 1 - x) + x;
}
string inline to_string(char c) {
  string second(1, c);
  return second;
}
template <typename T>
inline T gcd(T a, T b) {
  return a == 0 ? llabs(b) : gcd(b % a, a);
}
using ll = long long;
using ld = long double;
using pi = pair<ll, ll>;
using spi = pair<ll, pi>;
using dpi = pair<pi, pi>;
ll n, m, co, T[206][206], R[206][206], match[206 * 206 * 4], total;
bitset<206 * 206 * 4> vis;
char grid[206][206];
vector<int> v[206 * 206 * 4];
bool dfs(int x) {
  if (vis[x]) return 0;
  vis[x] = 1;
  for (auto i : v[x])
    if (match[i] == -1 || dfs(match[i])) {
      match[x] = i, match[i] = x;
      return 1;
    }
  return 0;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cin >> n >> m;
  for (ll i = 0; i <= ll(n - 1); ++i)
    for (ll j = 0; j <= ll(m - 1); ++j) cin >> grid[i][j];
  for (ll i = 0; i <= ll(n - 1); ++i)
    for (ll j = 0; j <= ll(m - 1); ++j) total += grid[i][j] == '#';
  memset((T), -1, sizeof((T))), memset((R), -1, sizeof((R)));
  for (ll i = 0; i <= ll(n - 1); ++i)
    for (ll j = 0; j <= ll(m - 1); ++j)
      if (grid[i][j] == '#' && i && grid[i - 1][j] == '#') T[i][j] = co++;
  for (ll i = 0; i <= ll(n - 1); ++i)
    for (ll j = 0; j <= ll(m - 1); ++j)
      if (grid[i][j] == '#' && grid[i][j + 1] == '#') R[i][j] = co++;
  auto add = [&](int x, int y) {
    if (x == -1 || y == -1) return;
    v[x].emplace_back(y), v[y].emplace_back(x);
  };
  for (ll i = 0; i <= ll(n - 1); ++i)
    for (ll j = 0; j <= ll(m - 1); ++j) add(T[i][j], R[i][j]);
  for (ll i = 0; i <= ll(n - 1); ++i)
    for (ll j = 1; j <= ll(m - 1); ++j) add(T[i][j], R[i][j - 1]);
  for (ll i = 1; i <= ll(n - 1); ++i)
    for (ll j = 0; j <= ll(m - 1); ++j) add(T[i][j], R[i - 1][j]);
  for (ll i = 1; i <= ll(n - 1); ++i)
    for (ll j = 1; j <= ll(m - 1); ++j) add(T[i][j], R[i - 1][j - 1]);
  memset((match), -1, sizeof((match)));
  ll mcbm = 0;
  for (ll i = 0; i <= ll(co - 1); ++i)
    if (match[i] == -1) vis.reset(), mcbm += dfs(i);
  cout << total - (co - mcbm) << '\n';
}
