using System; using static System.Console; using System.Linq; using System.Collections.Generic; class Program { static int NN => int.Parse(ReadLine()); static int[] NList => ReadLine().Split().Select(int.Parse).ToArray(); static int[][] NArr(int n) => Enumerable.Repeat(0, n).Select(_ => NList).ToArray(); static void Main() { var n = NN; var s = ReadLine(); WriteLine(Tunnel(s)); } static int Tunnel(string _s) { var s = _s.ToCharArray(); Array.Reverse(s); var late = 0; var res = 0; for (var i = 0; i < s.Length; ++i) { if (i > 0) { if (s[i - 1] == '#' && s[i] == '#') ++late; if (s[i - 1] == '.' && s[i] == '.') if (late > 0) --late; } if (s[i] == '#') { res = i + 1 + late; } } return (res); } }