n = int(input())
s = list(str(input()))


cnt1 = 0
cnt2 = 0

for k in range(n - 4):
    if s[k] == "#" and s[k+1] == "." and s[k+2] == "#" and s[k+3] == "." and s[k+4] == "#":
        s[k+1] = "#"
        s[k+3] = "#"
        cnt1 += 2

for i in range(n-1):
    if s[i] == "#" and s[i+1] == ".":
        s[i] = "."
        cnt2 += 1

print(cnt1 + cnt2)

# #が黒、.が白　#.と並ばなければおｋ
