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

def f(i, j):
	if j >= i:
		return "#"
	else:
		return "."

ans = float("inf")
tmp = 0
for j in range(N):
	if S[j] != f(0, j):
		tmp += 1
ans = tmp
for i in range(1, N):
	if f(i, i) != S[i]:
		tmp += 1
	else:
		tmp -= 1
	if tmp < ans:
		ans = tmp
tmp = 0
for i in range(N):
	if S[i] == "#":
		tmp += 1
if tmp < ans:
	ans = tmp
print(ans)