N = int(input())
S = input()
accumulation = [0]

# start = time.time()

addition = 0

# N-黒の累積和で白の数と計算する
for i in range(0, N):
    addition = 0
    if S[i] == "#":
        addition = 1
    accumulation.append(accumulation[i] + addition)

#print(accumulation)

workmin = N
worksum = 0
for j in range(1, N + 1):
    # jまでの黒の累積和 + j以降の白の累積和の最小値が答え

    black = accumulation[j]
    white = N - j - (accumulation[N] - accumulation[j])

    if workmin > black + white:
        workmin = black + white

# print("{}までの黒(#)の個数の累積和：{}".format(j, black))
# print("{}以降の白(.)の個数の累積和：{}".format(j, white))

print(workmin)