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

l = []
string = s[0]
cnt = 0
for i in range(n):
    if string == s[i]:cnt +=1
    else:
        l.append((string, cnt))
        string, cnt = s[i], 1

l.append((string, cnt))
#print(l)
string = ('.', 0)
ans = 0
for str, i in l:
    if string[0] == '#' and str == '.':
        ans += min(i, string[1])
        string = ('.', 0)
    else:
        string = (str, i)
print(ans)