import sys
input = sys.stdin.readline
n = int(input())
s = input()
num = []
bl = 0
wh = 0
for i in range(n):
    if s[i] == "#":
        num.append([i,wh])
        bl += 1
    else:
        wh += 1
min = n
if len(num) > 0:
    for i in range(len(num)):
        temp = (num[i][0] - num[i][1]) + (n - bl - num[i][1])
        if temp < min:
            min = temp
    print(min)
else:
    print("0")