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

    first_hash = N
    for i in range(N):
        if S[i] == '#':
            first_hash = i
            break

    all_hash = '#' * N
    all_dot = '.' * N
    medium = '.' * i + '#' * (N-i)

    count1 = 0
    for i in range(N):
        if S[i] != all_hash[i]:
            count1 += 1

    count2 = 0
    for i in range(N):
        if S[i] != all_dot[i]:
            count2 += 1

    count3 = 0
    for i in range(N):
        if S[i] != medium[i]:
            count3 += 1

    print(min(count1, count2, count3))

    
main()
