using System;

namespace Tenka1BC2019_C
{
    class Program
    {
        static void Main(string[] args)
        {
            var N = int.Parse(Console.ReadLine());
            var S = Console.ReadLine();

            var ans = 0;
            var cur = S[0];
            var cntB = S[0] == '#' ? 1 : 0;
            var cntW = S[0] == '.' ? 1 : 0;
            for (int i = 1; i < S.Length; i++)
            {
                if (S[i] == cur && cur == '#') cntB++;
                if (S[i] == cur && cur == '.') cntW++;

                if (S[i] != cur && cur == '#')
                {
                    cur = '.';
                    cntW++;
                }
                else if (S[i] != cur && cur == '.')
                {
                    ans += Math.Min(cntB, cntW);
                    cntW = 0;
                    cntB = 1;
                    cur = '#';
                }
            }

            if (S[S.Length - 1] == '.')
            {
                ans += Math.Min(cntB, cntW);
            }

            Console.WriteLine(ans);
        }
    }
}

