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>
#pragma GCC target("avx2,avx")
#pragma GCC optimize("O3")
#pragma GCC optimize("unroll-loops")
using namespace std;
using ll = long long;
using ull = unsigned long long;
using pii = pair<int, int>;
using pll = pair<long long, long long>;
constexpr char ln = '\n';
template <class T1, class T2>
inline bool chmax(T1 &a, T2 b) {
  if (a < b) {
    a = b;
    return true;
  }
  return false;
}
template <class T1, class T2>
inline bool chmin(T1 &a, T2 b) {
  if (a > b) {
    a = b;
    return true;
  }
  return false;
}
inline int topbit(int x) { return x == 0 ? -1 : 31 - __builtin_clz(x); }
inline int topbit(long long x) { return x == 0 ? -1 : 63 - __builtin_clzll(x); }
inline int botbit(int x) { return x == 0 ? 32 : __builtin_ctz(x); }
inline int botbit(long long x) { return x == 0 ? 64 : __builtin_ctzll(x); }
inline int popcount(int x) { return __builtin_popcount(x); }
inline int popcount(long long x) { return __builtin_popcountll(x); }
inline int kthbit(long long x, int k) { return (x >> k) & 1; }
inline void print() { cout << "\n"; }
template <class T>
inline void print(const vector<T> &v) {
  for (auto itr = v.begin(); itr != v.end(); ++itr) cout << *itr << " ";
  print();
}
template <class T, class... Args>
inline void print(const T &x, const Args &...args) {
  cout << x << " ";
  print(args...);
}
inline void debug() {}
template <class T>
inline void debug(const vector<T> &v) {}
template <class T, class... Args>
inline void debug(const T &x, const Args &...args) {}
struct Fast_ios {
  Fast_ios() {
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(20);
  };
} fast_ios;
template <typename flow_t>
struct Dinic {
  struct edge {
    int to;
    flow_t cap;
    int rev;
    edge() {}
    edge(int to, flow_t cap, int rev) : to(to), cap(cap), rev(rev) {}
  };
  vector<vector<edge>> G;
  vector<int> level, iter;
  Dinic() {}
  Dinic(int N) : G(N), level(N), iter(N) {}
  int add_edge(int from, int to, flow_t cap) {
    G[from].emplace_back(to, cap, G[to].size());
    G[to].emplace_back(from, 0, G[from].size() - 1);
    return G[to].back().rev;
  }
  void bfs(int s) {
    fill(level.begin(), level.end(), -1);
    queue<int> que;
    level[s] = 0;
    que.emplace(s);
    while (!que.empty()) {
      int v = que.front();
      que.pop();
      for (int i = 0; i < (int)G[v].size(); i++) {
        edge &e = G[v][i];
        if (e.cap > 0 && level[e.to] < 0) {
          level[e.to] = level[v] + 1;
          que.emplace(e.to);
        }
      }
    }
  }
  flow_t dfs(int v, int t, flow_t f) {
    if (v == t) return f;
    for (int &i = iter[v]; i < (int)G[v].size(); i++) {
      edge &e = G[v][i];
      if (e.cap > 0 && level[v] < level[e.to]) {
        flow_t d = dfs(e.to, t, min(f, e.cap));
        if (d == 0) continue;
        e.cap -= d;
        G[e.to][e.rev].cap += d;
        return d;
      }
    }
    return 0;
  }
  flow_t flow(int s, int t, flow_t lim) {
    flow_t fl = 0;
    while (true) {
      bfs(s);
      if (level[t] < 0 || lim == 0) break;
      fill(iter.begin(), iter.end(), 0);
      while (true) {
        flow_t f = dfs(s, t, lim);
        if (f == 0) break;
        fl += f;
        lim -= f;
      }
    }
    return fl;
  }
};
const int dy[4] = {-1, 0, 1, 0};
const int dx[4] = {0, -1, 0, 1};
int main() {
  int R, C;
  cin >> R >> C;
  vector<string> S(R);
  for (int i = 0; i < (R); ++i) cin >> S[i];
  map<int, int> dic;
  int N = 2;
  for (int i = 0; i < (R); ++i) {
    for (int j = 0; j < (C); ++j) {
      if (S[i][j] == '#') {
        dic.emplace(i * C + j, N++);
      }
    }
  }
  if (N == 2) {
    cout << 0 << ln;
    return 0;
  }
  Dinic<int> D(200000);
  int ans = 0;
  for (int i = 0; i < (R); ++i) {
    for (int j = 0; j < (C); ++j) {
      if (S[i][j] == '#') {
        int id = dic[i * C + j];
        D.add_edge(0, id, 1);
        D.add_edge(id, 1, 1);
        for (int k = 0; k < (2); ++k) {
          int ny = i + dy[k];
          int nx = j + dx[k];
          if (ny < 0 or nx < 0) continue;
          if (S[ny][nx] != '#') continue;
          int nid = dic[ny * C + nx];
          if (k) {
            D.add_edge(id, N, 1e9);
            D.add_edge(nid, N, 1e9);
            D.add_edge(0, N, 0);
            D.add_edge(N, 1, 1);
          } else {
            D.add_edge(N, id, 1e9);
            D.add_edge(N, nid, 1e9);
            D.add_edge(N, 1, 0);
            D.add_edge(0, N, 1);
          }
          ans++;
          N++;
        }
      }
    }
  }
  cout << D.flow(0, 1, 1e9) - ans << ln;
}
