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

class myon
{
    public static void Main(string[] args)
    {
        var myon = new myon();
    }

    public myon()
    {
        int N = int.Parse(Console.ReadLine());
        string S = Console.ReadLine();

        char[] Slist = new char[N];
        for(int i = 0;i < N;i++)
        {
            Slist[i] = S[i];
        }

        List<int> results = new List<int>();

            int eaB = 0;
            int laW = 0;

        if (S.Contains('#'))
        {
            results.Add(Slist.Count('#'));
            results.Add(Slist.Count('.'));



            for(int i = 0;i < N;i++)
            {
                if (Slist[i] == '#')
                {
                    eaB = i;
                    break;
                }
            }

            for (int i = 0; i < N; i++)
            {
                if (Slist[i] == '.')
                {
                    laW = i;
                }
            }

            

            int Bc = 0;
            


            for(int i = eaB;i <= laW;i++)
            {
                if (Slist[i] == '#') Bc++;
            }

            int Count = 0;

            int pos = laW;
            while(Bc > 0)
            {
                if(Slist[pos]  == '.')
                {
                    Count+=2;
                    pos--;
                }
            }

            results.Add(Count);
        }
        else
        {
            Console.WriteLine("0");
        }

        Console.WriteLine(results.Min);

    }
    bool Checker(char[] input)
    {
        bool bflag = false;

        for(int i = 0;i < input.Length;i++)
        {
            
        }
    }

    int CountLater(int Start, string S, int N)
    {
        int count = 0;
        for (int i = Start; i < N; i++)
        {
            if (S[i] == '.') count++;
        }

        return count;
    }
}
