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>
import java.io.*;
import java.util.*;

/*
polyakoff
*/

public class Main {

    static FastReader in;
    static PrintWriter out;
    static Random rand = new Random();
    static final int oo = (int) 2e9;
    static final long OO = (long) 4e18;
    static final int MOD = (int) 1e9 + 7;

    static int n, m;
    static char[][] grid;

    static class Dinic {
        class Edge {
            int u, v, c, f;

            Edge(int u, int v, int c) {
                this.u = u;
                this.v = v;
                this.c = c;
                f = 0;
            }
        }
        ArrayList<Edge> edges;
        ArrayList<Integer>[] adj;
        int[] d, ptr;

        Dinic(int n) {
            edges = new ArrayList<>(n * 4);
            adj = new ArrayList[n]; Arrays.setAll(adj, i -> new ArrayList<>());
            d = new int[n];
            ptr = new int[n];
        }

        boolean bfs(int s, int t) {
            LinkedList<Integer> q = new LinkedList<>();
            q.add(s);
            Arrays.fill(d, oo);
            d[s] = 0;
            while (!q.isEmpty()) {
                int u = q.poll();
                for (int ei : adj[u]) {
                    Edge e = edges.get(ei);
                    if (e.f < e.c && d[e.v] == oo) {
                        q.add(e.v);
                        d[e.v] = d[u] + 1;
                    }
                }
            }
            return d[t] != oo;
        }
        int dfs(int u, int t, int minDelta) {
            if (u == t)
                return minDelta;
            for (; ptr[u] < adj[u].size(); ptr[u]++) {
                int ei = adj[u].get(ptr[u]);
                Edge e = edges.get(ei);
                if (e.f < e.c && d[e.v] == d[u] + 1) {
                    int pushed = dfs(e.v, t, Math.min(minDelta, e.c - e.f));
                    if (pushed != 0) {
                        e.f += pushed;
                        edges.get(ei ^ 1).f -= pushed;
                        return pushed;
                    }
                }
            }
            return 0;
        }

        void addEdge(int u, int v, int c) {
            adj[u].add(edges.size());
            edges.add(new Edge(u, v, c));
            adj[v].add(edges.size());
            edges.add(new Edge(v, u, 0));
        }
        int maxFlow(int s, int t) {
            int flow = 0;
            while (bfs(s, t)) {
                Arrays.fill(ptr, 0);
                int delta;
                while ((delta = dfs(s, t, oo)) != 0)
                    flow += delta;
            }
            return flow;
        }
    }

    static void solve() {
        n = in.nextInt();
        m = in.nextInt();

        grid = new char[n][];
        for (int i = 0; i < n; i++)
            grid[i] = in.next().toCharArray();

        int black = 0, V = 0;
        int[][] borders = new int[n * m][4];
        for (int i = 0; i < n * m; i++)
            Arrays.fill(borders[i], -1);
        for (int i = 0; i < n; i++) {
            for (int j = 0; j < m; j++) {
                if (grid[i][j] == '#') {
                    black++;
                    if (i - 1 >= 0 && grid[i - 1][j] == '#') {
                        borders[(i - 1) * m + j][2] = V;
                        borders[i * m + j][0] = V;
                        V++;
                    }
                    if (j - 1 >= 0 && grid[i][j - 1] == '#') {
                        borders[i * m + j - 1][1] = V;
                        borders[i * m + j][3] = V;
                        V++;
                    }
                }
            }
        }

        Dinic dinic = new Dinic(V + 2);
        for (int i = 0; i < n * m; i++) {
            if (borders[i][0] != -1)
                dinic.addEdge(V, borders[i][0], 1);
            if (borders[i][3] != -1)
                dinic.addEdge(borders[i][3], V + 1, 1);
            if (borders[i][0] != -1 && borders[i][1] != -1)
                dinic.addEdge(borders[i][0], borders[i][1], 1);
            if (borders[i][1] != -1 && borders[i][2] != -1)
                dinic.addEdge(borders[i][2], borders[i][1], 1);
            if (borders[i][2] != -1 && borders[i][3] != -1)
                dinic.addEdge(borders[i][2], borders[i][3], 1);
            if (borders[i][3] != -1 && borders[i][0] != -1)
                dinic.addEdge(borders[i][0], borders[i][3], 1);
        }

        int maxFlow = dinic.maxFlow(V, V + 1);
        out.println(black - (V - maxFlow));


    }

    public static void main(String[] args) throws FileNotFoundException {
        in = new FastReader(System.in);
//        in = new FastReader(new FileInputStream("sometext.txt"));
        out = new PrintWriter(System.out);
//        out = new PrintWriter(new FileOutputStream("output.txt"));

        int T = 1;
//        T = in.nextInt();
        while (T-- > 0)
            solve();

//        Thread thread = new Thread(null, () -> {
//            solve();
//        }, "Main", 1 << 28);
//        thread.start();
//        try {
//            thread.join();
//        } catch (InterruptedException e) {
//            e.printStackTrace();
//        }

//        out.flush();
        out.close();
    }

    static class FastReader {
        BufferedReader br;
        StringTokenizer st;

        FastReader(InputStream is) {
            br = new BufferedReader(new InputStreamReader(is));
        }

        Integer nextInt() {
            return Integer.parseInt(next());
        }

        Long nextLong() {
            return Long.parseLong(next());
        }

        Double nextDouble() {
            return Double.parseDouble(next());
        }

        String next() {
            while (st == null || !st.hasMoreTokens()) {
                st = new StringTokenizer(nextLine());
            }
            return st.nextToken();
        }

        String nextLine() {
            String s = "";
            try {
                s = br.readLine();
            } catch (IOException e) {
                e.printStackTrace();
            }
            return s;
        }
    }

    static void dbg(Object... args) {
        for (Object arg : args)
            out.print(" " + arg);
        out.flush();
    }

}