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


class Program
{
    static void Main(string[] args)
    {
        // 入力
        //var s = Console.ReadLine();
        var n = long.Parse(Console.ReadLine());
        char[] s = Console.ReadLine().ToCharArray();

        long ans = 0;
        long b = 0;
        long w = 0;
        for (int i = 0; i < n - 1; i++)
        {
            if (s[i] == '#')
            {
                b++;
                if (s[i + 1] == '.')
                {
                    for (int k = i + 1; k < n; k++)
                    {
                        if (s[k] == '.') w++;
                        else break;
                    }

                    if (b >= w) ans += w;
                    else ans += b;

                    b = 0;
                    w = 0;
                }
            }
        }


        // 出力
        Console.WriteLine(ans);
    }
}