using System;
class Tenka1_2019_C
{
    static void Main(string[] args)
    {
        int N = int.Parse(Console.ReadLine());
        string S = Console.ReadLine();

        int[] black = new int[N];
        int[] white= new int[N];

        int blackCount = 0;
        for (int i = 0; i < N; i++)
        {
            if(S[i]=='#') { blackCount++; }
            black[i] = blackCount;
            white[i] = (i+1) - blackCount;
        }

        if(black[N-1]==0 || white[N-1] == 0)
        {
            Console.WriteLine("0");
            return;
        }

        int min = int.MaxValue;
        for (int i = 0; i < N; i++)
        {
            if (S[i] == '.') continue;

            int left = black[i] - 1;
            int right = white[N - 1] - white[i];

            if (left + right < min) min = left + right;
        }

        Console.WriteLine(min);
    }
}
