import sys
input = sys.stdin.readline
n = int(input())
s = input()
num = -1
bl = 0
for i in range(n):
    if s[i] == "#":
        if bl == 0:
            num = i
        bl += 1
if num >= 0 and bl > n - num - bl:
    print(n-num-bl)
else:
    print(bl)