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

class MainClass
{
    static void Main()
    {
        int N = int.Parse(Console.ReadLine());
        string S = Console.ReadLine();

        int now = S.Length - 1;
        int ans = 0;
        while (now>=0)
        {
            int CountWhite = 0;
            while (now >= 0 && S[now] == '.')
            {
                CountWhite++;
                now--;
            }
            int CountBlack = 0;
            while (now >= 0 && S[now] == '#')
            {
                CountBlack++;
                now--;
            }
            ans += Math.Min(CountWhite, CountBlack);
        }
        Console.WriteLine(ans);
    }
}