N = int(raw_input())
S = list(raw_input())

c = 0
for i in range(N):
      if S[N-1-i] == "#":
            c += 1
      else:
            break
if c > 0:
      S = S[:-c]

cc = 0

for j in range(N-c):
      if S[j] == ".":
            cc += 1
if N-cc>0:
      print(min(cc, N-cc))
else:
      print("0")
