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

# count '#'
count_b = []
count = 0
for i in range(n):
    if s[i] == '#':
        count += 1
    count_b.append(count)

count_w = []
count = 0
for i in range(n-1, -1, -1):
    if i == n-1:
        count_w.insert(0, 0)
    elif s[i+1] == '.':
        count += 1
    count_w.insert(0, count)

total = [b + w for b, w in zip(count_b, count_w)]

print(min(total))