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

prev = '#'
conv_idx = len(S)
for i, s in enumerate(reversed(S)):
    if s == '.':
        conv_idx = len(S) - i
        break

count_b = 0
count_w = 0
for i, s in enumerate(S[:conv_idx]):
    if s == '#':
        count_b += 1
    else:
        count_w += 1

ans = min(count_b, count_w)

print(ans)