N = int(input())
S = input()

L = [[S[0], 1]]
cur = 0
for i in range(1, N):
    if S[i] == S[i-1]:
        L[cur][1] += 1
    else:
        L.append([S[i], 1])
        cur += 1

start, goal = 0, len(L)
if L[0][0] == '.':
    start += 1
if L[-1][0] == '#':
    goal -= 1

btw, wtb = 0, 0
for i in range(start, goal):
    if L[i][0] == '#':
        btw += L[i][1]
    else:
        wtb += L[i][1]

print(min(btw, wtb))