
n=int(input())
s=str(input())
"""
n = 8
s = ".#####.#"
print(s)
print(len(s))
"""
def search(n,s):
    memo = []
    countwb=0
    now = s[0]
    count = 0
    if now == "#":
        memo.append(0)
    while(count<n):
        if s[count]==now:
            countwb+=1
        else:
            memo.append(countwb)
            countwb = 1
            now = s[count]
        count+=1
    memo.append(countwb)
    #print("memo",memo)

    count_b = []
    c_b = 0
    for  i in range(1,len(memo),2):
            c_b += memo[i]
            count_b.append(c_b)
    #print(count_b)

    count_w = []
    c_w = 0
    for  i in range(0,len(memo),2):
            c_w += memo[i]
            count_w.append(c_w)
    #print(count_w)

    #白白．．．黒黒にする
    w_b = 0
    if len(memo)%2==1:
        #最後が白
        w_b += memo[-1]
        if len(count_w)>1:
            new_n = n -  memo[-1]
            new_s = s[:int(-1*memo[-1])]
            #print("new_n",new_n)
            #print("new_s",new_s)
            w_b += search(new_n,new_s)
    else:
        #最後が黒
        if len(count_b)>1:
            new_n = n -  memo[-1]
            new_s = s[:int(-1*memo[-1])]
            #print("new_n",new_n)
            #print("new_s",new_s)
            w_b += search(new_n,new_s)
    #print("w_b",w_b)
    #全部白にする
    allw = 0
    if count_b!=[]:
        allw = count_b[-1]
    #print("allw",allw)
    #全部黒にする
    allb = 0
    if count_w!=[]:
        allb = count_w[-1]
    #print("allb",allb)

    return min(w_b,allb,allw)

print(search(n,s))