N = int(input())
S = input()


ini_w = 0
for i in range(len(S)):
    if S[i] == '.':
        ini_w = ini_w + 1
    else:
        break
    
if ini_w >= len(S)-1:
    print(0)
    exit()
    
S = S[ini_w:]

all_w = len(S) - S.count(".")
all_b = len(S) - all_w

other = 2*10000000

last_b = 0

for i in range(len(S)):
    if S[len(S)-i-1] == '#':
        last_b = last_b + 1
    else:
        break

other = all_w - last_b
#print(other,last_b)
print(min(all_w,all_b,other))