using System;
using System.Linq;

namespace C___Stones
{
    class Program
    {
        static void Main(string[] args)
        {
            var N = int.Parse(Console.ReadLine());
            var S = Console.ReadLine().ToCharArray();
            var arr = new char[N];
            int count = 0;

            Array.Copy(S, arr, N);

            for (int i = 0; i < N - 1; i++)
            {
                if (arr[i] == '#' && arr[i + 1] == '.')
                {
                    int b = i, w = i + 1;
                    int black = 0, white = 0;

                    while (b >= 0 && arr[b] == '#')
                    {
                        b--;
                        black++;
                    }

                    while (w < N && arr[w] == '.')
                    {
                        w++;
                        white++;
                    }

                    if (black > white)
                    {
                        count += new string(arr).Substring(i, N - i).Where(x => x == '.').Count();
                        break;
                    }

                    Console.WriteLine($"b: {b} black: {black} w: {w} white: {white}");
                    count += Math.Min(black, white);
                }
            }

            count = Math.Min(count, S.Count(x => x == '#'));
            count = Math.Min(count, S.Count(x => x == '.'));

            Console.WriteLine(count);
        }
    }
}
