N = int(input())
S = input()
if N == 1:
    print("0")
    exit()
for i in range(N-1):
    if S[i] == "." and S[i+1] == "#":
        break
sharp_count = 0
for j in range(i+1,N):
    if S[j] == "#":
        sharp_count += 1

for i in range(N-1):
    index = (N-1)-i
    if S[index] == "#" and S[index-1] == ".":
        break

dot_count = 0
for j in range(index,N):
    if S[j] == "#":
        dot_count += 1

dot_count += S[:index].count(".#")
        
print(min(sharp_count,dot_count, S.count(".#")))