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;


        int bcount = 0;
        int wcount = 0;
        for (int i = 0; i < N; i++)
        {
            if (Slist[i] == '#') bcount++;
            else wcount++;
        }
        results.Add(bcount);
        results.Add(wcount);



        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 Wc =(laW - eaB + 1)-Bc ;
        int pos = laW;
        while (Wc>1)
        {
            if (Slist[pos] == '.')
            {
                Count += 2;
                Wc--;
                pos--;
            }
        }

        results.Add(Count);




        Console.WriteLine(results.Min());

    }
}