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

penals1 = []
penals2 = []
tmp1 = 0
tmp2 = 0

for i in range(N // 2 + 1):
    if S[i] == "#":
        tmp1 += 1
    
    if S[-(i+1)] == ".":
        tmp2 += 1
    penals1.append(tmp1)
    penals2.append(tmp2)
    #penals2.insert(0, tmp2)

#min_p = [penals2[-1]] + [penals1[i] + penals2[-i] for i in range(N // 2 + 1)]

if N % 2 == 0: 
    # i = N//2-1
    min_p = tmp1 + tmp2 # save
    #min_p = penals2[-1] + tmp2 # save
    i = N // 2  # right-> N // 2 
    j = N // 2 - 2 # left -> 0
elif N >= 3: 
    val1 = penals1[-1] + penals2[-2]
    #i = N//2-1
    #val1 = tmp1 + penals2[-2]
    #i = N//2-2
    val2 = penals1[-2] + penals2[-1]
    #val2 = penals1[-1] + tmp2
    min_p = min(val1, val2)
    i = (N-1) // 2 + 1  # right -> N // 2 
    j = (N-1) // 2 - 2 # left -> 0
else:
    min_p = 2 # dummy


#for i in range(N//2+1, N-1):
while i < N-1 and N >= 2:
    #assert j >= 0, "i=%d, j=%d" % (i, j)
    if S[i] == "#":
        tmp1 += 1
    if S[-(i+1)] == ".":
        tmp2 += 1

    # i = N//2+1 -> N-2
    val1 = tmp1 + penals2[j]
    
    # j = N//2-2 -> 0
    #print(j, penals1[j], tmp2)
    val2 = penals1[j] + tmp2 
    val = min(val1, val2)
    if val < min_p:
        min_p = val
    i += 1
    j -= 1

if S[N-1] == "#":
    tmp1 += 1
if S[0] == ".":
    tmp2 += 1

val = min(tmp1, tmp2)
if val < min_p:
    min_p = val

print(min_p)