import sys
import itertools
# import numpy as np
import time
import math
import heapq
from collections import defaultdict
from collections import Counter
sys.setrecursionlimit(10 ** 7)
 
INF = 10 ** 18
MOD = 10 ** 9 + 7
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines

# map(int, input().split())

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

left = -1 
right = N - 1
while left < N - 1 and S[left + 1] == '.':
    left += 1

cw = 0
acc = [0] * N
while right >= left:
    if S[right] == '.':
        cw += 1
    acc[right] = cw
    right -= 1

ans = acc[left]
cb = 0
for i, c in enumerate(S[left:]):
    if c == '#':
        cb += 1
    now = acc[i] + cb
    ans = min(ans, now)
print(ans)



