n = int(input())
s = list(input())
while s[-1] == "#":
    s.pop()
s = "".join(s)
n = len(s)
data = []
ind = []
cnt = 0
ans = 0
for i in range(n):
    if s[i] == "#":
        cnt += 1
        ind.append(i)
    data.append(cnt)
if not ind:
    print(0)
    exit()
for i in ind:
    m = data[-1]-data[i]+1
    l = n-m-i
    if l > m:
        ans += 1
    else:
        print(ans+l)
        break
else:
    print(ans)