using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

class Program
{
    static void Main(string[] args)
    {
        long[] input = Console.ReadLine().Split(' ').Select(x => long.Parse(x)).ToArray();
        long H = input[0];
        long W = input[1];

        char[,] map = new char[H, W];
        for (int i = 0; i < H; i++)
        {
            string row = Console.ReadLine();
            for (int j = 0; j < W; j++)
            {
                map[i, j] = row[j];
            }
        }

        long[,] ans = new long[H, W];
        for (int i = 0; i < H; i++)
        {
            for (int j = 0; j < W; j++)
            {
                if (i == 0 && j == 0)
                {
                    if (map[i, j] == '#')
                    {
                        ans[i, j] = 1;
                    }
                    else
                    {
                        ans[i, j] = 0;
                    }
                }
                else if (i == 0)
                {
                    if (map[i, j] == '#')
                    {
                        if (map[i, j - 1] == '#')
                        {
                            ans[i, j] = ans[i, j - 1];
                        }
                        else
                        {
                            ans[i, j] = ans[i, j - 1] + 1;
                        }
                    }
                    else
                    {
                        ans[i, j] = ans[i, j - 1];
                    }
                }
                else if (j == 0)
                {
                    if (map[i, j] == '#')
                    {
                        if (map[i - 1, j] == '#')
                        {
                            ans[i, j] = ans[i - 1, j];
                        }
                        else
                        {
                            ans[i, j] = ans[i - 1, j] + 1;
                        }

                    }
                    else
                    {
                        ans[i, j] = ans[i - 1, j];
                    }
                }
                else
                {
                    if (map[i, j] == '#')
                    {
                        if (map[i - 1, j] == '#' && map[i, j - 1] == '#')
                        {
                            ans[i, j] = Math.Min(ans[i - 1, j], ans[i, j - 1]);
                        }
                        else if (map[i, j - 1] == '#')
                        {
                            ans[i, j] = Math.Min(ans[i - 1, j] + 1, ans[i, j - 1]);
                        }
                        else if (map[i - 1, j] == '#')
                        {
                            ans[i, j] = Math.Min(ans[i - 1, j], ans[i, j - 1] + 1);
                        }
                        else
                        {
                            ans[i, j] = Math.Min(ans[i - 1, j] + 1, ans[i, j - 1] + 1);
                        }
                    }
                    else
                    {
                        ans[i, j] = Math.Min(ans[i - 1, j], ans[i, j - 1]);
                    }
                }
            }
        }

        Console.WriteLine(ans[H - 1, W - 1]);
    }
}


Measured memory_bytes: 13292