

def main():
    N = int(input())
    S = list(input())

    flg = 0
    ans = 0
    for i in range(N):
        if S[i] == '#':
            flg = 1
        if flg and S[i] == '.':
            ans += 1

    flg = 0
    ans_2 = 0
    for i in range(N)[::-1]:
        if S[i] == '.':
            flg = 1
        if flg and S[i] == '#':
            ans_2 += 1

    left = 0
    righ = N - 1
    ans_3 = 0
    while 1:
        while S[left] == '.':
            left += 1
            if left == N:
                break

        while S[righ] == '#':
            righ -= 1
            if righ == -1:
                break

        ans_3 += 2
        righ -= 1
        left += 1

        if left > righ:
            break

    if righ + 1 == left:
        pass
    else:
        ans_3 -= 2



    print(min(ans, ans_2, ans_3))




if __name__ == '__main__':
    main()
