import sys input = sys.stdin.readline sys.setrecursionlimit(10 ** 7) INF = float("INF") MOD = 10 ** 9 + 7 MOD2 = 998244353 from heapq import heappop, heappush import math from collections import Counter, deque from itertools import accumulate, combinations, combinations_with_replacement, permutations from bisect import bisect_left, bisect_right import decimal n = int(input()) s = list(map(lambda x : 1 if x == "#" else 0, list(input().rstrip()))) ad = 0 ad_buff = 0 dbl = False last = n - 1 for i in range(n)[::-1]: if s[i]: last = i ad = max(0, ad - ad_buff) ad_buff = 0 if s[i]: if dbl: ad += 1 else: dbl = True else: if dbl: dbl = False else: ad_buff += 1 print(n - last + ad)