N = int(input())
S = input()
list_S = list(S)

i = 0
ans = 0
cnt = 0
while i < N:
    b = i
    f = i
    if list_S[i] == '.':
        i += 1
    else:
        if i+1 >= N:
            i +=1
        elif list_S[i+1] == '.':
            while True:
                cnt += 1
                b -= 1
                f += 1
                if b < 0:
                    if list_S[f] == '.':
                        for j in range(b+1, i+1):
                            list_S[j] = '.'
                        ans += cnt
                        i = f
                        cnt = 0
                        break
                    else:
                        for j in range(i+1, f):
                            list_S[j] = '#'
                        ans += cnt - 1
                        i = f
                        cnt = 0
                        break
                elif f >= N:
                    ans += cnt -1
                    i = f
                    break
                elif list_S[b] == '.' and list_S[f] == '.':
                    for j in range(b+1, i+1):
                        list_S[j] = '.'
                    ans += cnt
                    i = f
                    cnt = 0
                    break
                elif list_S[b] == '#' and list_S[f] == '.':
                    continue
                elif list_S[b] == '.' and list_S[f] == '#':
                    for j in range(i+1, f):
                        list_S[j] = '#'
                    ans += cnt - 1
                    i = f
                    cnt = 0
                    break
                elif list_S[b] == '#' and list_S[f] == '#':
                    for j in range(i+1, f):
                        list_S[j] = '#'
                    ans += cnt - 1
                    i = f
                    cnt = 0
                    break
        else:
            i += 1

print(ans)