A brick is defined as a rectangle with integer side lengths with either width 1 or height 1 (or both).

There is an n× m grid, and each cell is colored either black or white. A tiling is a way to place bricks onto the grid such that each black cell is covered by exactly one brick, and each white cell is not covered by any brick. In other words, bricks are placed on black cells only, cover all black cells, and no two bricks overlap.

<image> An example tiling of the first test case using 5 bricks. It is possible to do better, using only 4 bricks. 

What is the minimum number of bricks required to make a valid tiling?

Input

The first line contains two integers n, m (1≤ n, m≤ 200) — the number of rows and columns, respectively.

The next n lines describe the grid. The i-th of these lines contains a string of length m, where the j-th character denotes the color of the cell in row i, column j. A black cell is given by "#", and a white cell is given by ".".

It is guaranteed that there is at least one black cell.

Output

Output a single integer, the minimum number of bricks required.

Examples

Input


3 4
#.##
####
##..


Output


4


Input


6 6
######
##....
######
##...#
##...#
######


Output


6


Input


10 8
####..##
#..#.##.
#..#.###
####.#.#
....####
.###.###
###.#..#
########
###..###
.##.###.


Output


18

Note

The first test case can be tiled with 4 bricks placed vertically.

The third test case can be tiled with 18 bricks like this:

<image>
#include <bits/stdc++.h>
using namespace std;
constexpr long long mod = 1000000007;
const long long INF = mod * mod;
const long double eps = 1e-8;
const long double pi = acosl(-1.0);
long long mod_pow(long long x, long long n, long long m = mod) {
  long long res = 1;
  while (n) {
    if (n & 1) res = res * x % m;
    x = x * x % m;
    n >>= 1;
  }
  return res;
}
struct modint {
  long long n;
  modint() : n(0) { ; }
  modint(long long m) : n(m) {
    if (n >= mod)
      n %= mod;
    else if (n < 0)
      n = (n % mod + mod) % mod;
  }
  operator int() { return n; }
};
bool operator==(modint a, modint b) { return a.n == b.n; }
modint operator+=(modint& a, modint b) {
  a.n += b.n;
  if (a.n >= mod) a.n -= mod;
  return a;
}
modint operator-=(modint& a, modint b) {
  a.n -= b.n;
  if (a.n < 0) a.n += mod;
  return a;
}
modint operator*=(modint& a, modint b) {
  a.n = ((long long)a.n * b.n) % mod;
  return a;
}
modint operator+(modint a, modint b) { return a += b; }
modint operator-(modint a, modint b) { return a -= b; }
modint operator*(modint a, modint b) { return a *= b; }
modint operator^(modint a, long long n) {
  if (n == 0) return modint(1);
  modint res = (a * a) ^ (n / 2);
  if (n % 2) res = res * a;
  return res;
}
long long inv(long long a, long long p) {
  return (a == 1 ? 1 : (1 - p * inv(p % a, a)) / a + p);
}
modint operator/(modint a, modint b) { return a * modint(inv(b, mod)); }
const int max_n = 1 << 19;
modint fact[max_n], factinv[max_n];
void init_f() {
  fact[0] = modint(1);
  for (int i = 0; i < max_n - 1; i++) {
    fact[i + 1] = fact[i] * modint(i + 1);
  }
  factinv[max_n - 1] = modint(1) / fact[max_n - 1];
  for (int i = max_n - 2; i >= 0; i--) {
    factinv[i] = factinv[i + 1] * modint(i + 1);
  }
}
modint comb(int a, int b) {
  if (a < 0 || b < 0 || a < b) return 0;
  return fact[a] * factinv[b] * factinv[a - b];
}
int gcd(int a, int b) {
  if (a < b) swap(a, b);
  while (b) {
    int r = a % b;
    a = b;
    b = r;
  }
  return a;
}
struct edge {
  int to;
  int cap;
  int rev;
};
struct Dinic {
 private:
  int n;
  vector<vector<edge>> v;
  vector<int> dist, iter;

 public:
  Dinic(int sz) : n(sz), v(sz), dist(sz), iter(sz) {}
  void add_edge(int from, int to, int cap) {
    int x = v[to].size(), y = v[from].size();
    v[from].push_back({to, cap, x});
    v[to].push_back({from, 0, y});
  }
  void bfs(int s) {
    fill(dist.begin(), dist.end(), -1);
    queue<int> q;
    dist[s] = 0;
    q.push(s);
    while (q.size()) {
      int x = q.front();
      q.pop();
      for (int i = 0; i < v[x].size(); i++) {
        edge& e = v[x][i];
        if (e.cap > 0 && dist[e.to] < 0) {
          dist[e.to] = dist[x] + 1;
          q.push(e.to);
        }
      }
    }
  }
  int dfs(int x, int t, int f) {
    if (x == t) return f;
    for (int& i = iter[x]; i < (int)v[x].size(); ++i) {
      edge& e = v[x][i];
      if (e.cap > 0 && dist[x] < dist[e.to]) {
        int d = dfs(e.to, t, min(f, e.cap));
        if (d > 0) {
          e.cap -= d;
          v[e.to][e.rev].cap += d;
          return d;
        }
      }
    }
    return 0;
  }
  int max_flow(int s, int t) {
    int flow = 0;
    while (1) {
      bfs(s);
      if (dist[t] < 0) return flow;
      fill(iter.begin(), iter.end(), 0);
      int f;
      while (f = dfs(s, t, mod) > 0) flow += f;
    }
  }
};
void solve() {
  int h, w;
  cin >> h >> w;
  vector<string> mp(h);
  for (int i = 0; i < h; i++) cin >> mp[i];
  int s = h * (w - 1) + w * (h - 1);
  int t = s + 1;
  int cnt = 0;
  Dinic dc(t + 1);
  for (int i = 0; i < h; i++)
    for (int j = 0; j < w - 1; j++) {
      if (mp[i][j] == '#' && mp[i][j + 1] == '#') {
        int id = i * (w - 1) + j;
        dc.add_edge(id, t, 1);
        cnt++;
      }
    }
  int x = h * (w - 1);
  for (int i = 0; i < h - 1; i++)
    for (int j = 0; j < w; j++) {
      if (mp[i][j] == '#' && mp[i + 1][j] == '#') {
        int id = x + i * w + j;
        dc.add_edge(s, id, 1);
        cnt++;
      }
    }
  for (int i = 0; i < h; i++)
    for (int j = 0; j < w - 1; j++) {
      if (mp[i][j] == '#' && mp[i][j + 1] == '#') {
        int id = i * (w - 1) + j;
        if (i > 0) {
          if (mp[i - 1][j] == '#') {
            int to = x + (i - 1) * w + j;
            dc.add_edge(to, id, mod);
          }
          if (mp[i - 1][j + 1] == '#') {
            int to = x + (i - 1) * w + j + 1;
            dc.add_edge(to, id, mod);
          }
        }
        if (i + 1 < h) {
          if (mp[i + 1][j] == '#') {
            int to = x + i * w + j;
            dc.add_edge(to, id, mod);
          }
          if (mp[i + 1][j + 1] == '#') {
            int to = x + i * w + j + 1;
            dc.add_edge(to, id, mod);
          }
        }
      }
    }
  int f = dc.max_flow(s, t);
  int ans = 0;
  for (int i = 0; i < h; i++)
    for (int j = 0; j < w; j++)
      if (mp[i][j] == '#') ans++;
  ans -= cnt - f;
  cout << ans << "\n";
}
signed main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  solve();
  return 0;
}
