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

namespace Tenka1_2019
{
    class C
    {
        static void Main(string[] args)
        {
            int n = int.Parse(Console.ReadLine());
            string s = Console.ReadLine();
            int ans = 0;
            int black = 0, white = 0;
            int count = 0;
            for (int i = 0; i < n; i++)
            {
                if (s.Substring(i, 1) == "#") {
                    black++;
                    if (count == 2) {
                        ans += white <= black ? white : black;
                        white = 0;black = 0;
                    }
                    count = 1;
                }
                else {
                    white++;
                    
                    count = 2; }
            }
            if (count == 2&&black>=1) { ans += white <= black ? white : black; }
            Console.WriteLine(ans);
        }
    }
}
