using System;
using System.Collections.Generic;
using System.Linq;

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

            S = new string(S.Reverse().ToArray());
            var w = new List<int>();
            var b = new List<int>();

            var countW = true;
            var count = 0;
            for (int i = 0; i < S.Length; i++)
            {
                if (countW)
                {
                    if (S[i] == '.')
                    {
                        count++;
                    }
                    else
                    {
                        i--;
                        if (count > 0)
                        {
                            w.Add(count);
                        }
                        count = 0;
                        countW = !countW;
                    }
                }
                else
                {
                    if (S[i] == '#')
                    {
                        count++;
                    }
                    else
                    {
                        i--;
                        b.Add(count);
                        count = 0;
                        countW = !countW;
                    }
                }
            }
            if (countW)
            {
                w.Add(count);
            }
            else
            {
                b.Add(count);
            }

            if (w.Count == 0 || b.Count == 0)
            {
                Console.WriteLine(0);
                return;
            }
            
            var sum = new List<int>();
            var tmpSum = 0;
            for (int i = 0; i < w.Count; i++)
            {
                for (int j = 0; j < w.Count; j++)
                {
                    if (j <= i)
                    {
                        if (j < w.Count)
                            tmpSum += w[j];
                    }
                    else
                    {
                        if (j <b.Count)
                            tmpSum += b[j];
                    }
                }
                sum.Add(tmpSum);
            }

            Console.WriteLine(sum.Min());
        }
    }
}