import collections
n = int(input())

a = list(input())
su = 0
co = 1
coo = 0
c = 0
cc = 0
k = a[0]
c1 = n
c2 = 0
c3 = 0
aa = []
p = a.count("#")
pp = a.count(".")

for i in range(n-1):
	if k == a[i+1]:
		co += 1
	else:
		aa.append([k,co])
		k = a[i+1]
		co = 1

aa.append([k,co])
co = 0
if aa[-1][0] == ".":
	aa.append(["#",0])
for i in range(len(aa)):
	if aa[-(i+1)][0] == "#":
		c += aa[-(i+1)][1]
		c3 += aa[-(i+1)][1]
		c1 = min(c1,cc + p - c)
	else:
		c1 = min(c1,c + pp - cc)
		cc += aa[-(i+1)][1]
		c2 += aa[-(i+1)][1]

print(min(c1,c2,c3))

