F. Down Up Disco
time limit per test
2 seconds
memory limit per test
256 megabytes
input
standard input
output
standard output

Dhomas owns a disco club in downtown Daustin. His dance floor is an $$$N \times M$$$ grid of illuminated tiles, and there is a person standing on each tile. Dhomas designed the dance floor with a unique quirk. Dhomas can select a tile at $$$(\text{row} = R, \text{column} = C)$$$ and reverse the direction of gravity for all tiles at position $$$(\text{row} = i, \text{column} = j)$$$ where $$$i \leq R$$$ and $$$j \leq C$$$. Dhomas defines this entire process as one "reversal" on the dance floor. If the person on such a tile is standing right-side up initially, they will be flipped upside down. Likewise, if they are upside down, they will be flipped right-side up.

As the disco club is coming to a close for the night, Dhomas needs to flip everyone on the dance floor back to the right-side up position before they leave. Dhomas wants to do this quickly so he asks you to find the minimum number of reversals required to flip everyone on the dance floor right-side up.

Input

The first line of input contains two space-separated integers $$$N, M\ (1 \leq N, M \leq 3000) - $$$ the vertical and horizontal dimensions of the dance floor.

The next $$$N$$$ lines each contain $$$M$$$ integers. The integer at $$$(\text{line} = i, \text{column} = j)$$$ indicates that the person standing on tile $$$(i,j)$$$ is initially either upside down $$$(1)$$$ or right-side up $$$(0)$$$.

Output

Output one integer, the minimum number of reversals needed to flip everyone on the dance floor right-side up (reset the entire grid to $$$0$$$s).

Examples
Input
2 2
10
00
Output
1
Input
2 3
110
100
Output
3
Input
5 7
1101001
1101001
1101001
1111011
1111111
Output
7