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

namespace AtCoder
{
    class Program
    {
        static void Main(string[] args)
        {
            int n = int.Parse(Console.ReadLine());
            string s = Console.ReadLine();

            var list = new List<int>(n);
            int count = 1;
            int mi = 0;
            int max = 0;
            for (int i = 1; i < n; i++)
            {
                if (s[i - 1] == s[i]) count++;
                else
                {
                    list.Add(count);
                    if (count > max)
                    {
                        max = count;
                        mi = list.Count - 1;
                    }
                    count = 1;
                }
            }
            list.Add(count);
            if (count > max)
            {
                max = count;
                mi = list.Count - 1;
            }

            int c = 0;
            if (s[0] == '.')
            {
                if (mi % 2 == 0)
                {
                    // white
                    for (int i = 1; i < mi; i += 2) c += list[i];
                    for (int i = mi + 2; i < list.Count - 1; i += 2) c += list[i];
                }
                else
                {
                    // black
                    for (int i = 1; i < mi; i += 2) c += list[i];
                    for (int i = mi + 1; i < list.Count; i += 2) c += list[i];
                }
            }
            else
            {
                if (mi % 2 != 0)
                {
                    // white
                    for (int i = 0; i < mi; i += 2) c += list[i];
                    for (int i = mi + 2; i < list.Count - 1; i += 2) c += list[i];
                }
                else
                {
                    // black
                    for (int i = 0; i < mi; i += 2) c += list[i];
                    for (int i = mi + 1; i < list.Count; i += 2) c += list[i];
                }
            }
            
            Console.WriteLine(c);
        }
    }
}
