import itertools
from collections import Counter
import bisect

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

    if S.count('.') == N or S.count('#') == N:
        print(0)
        exit()

    total_white = S.count('.')
    total_black = S.count('#')
    ans = min(total_white, total_black)
    rest_white = total_white

    current_ans = 0
    S += '#'  # 番兵
    black_count = 0
    white_count = 0
    for i in range(len(S)):
        if S[i] == '#':
            black_count += 1
            if white_count > 0:
                # consider
                tob = black_count - 1
                current_ans += tob
                ans = min(ans, current_ans + white_count + rest_white, current_ans + tob + rest_white)

                white_count = 0
                black_count = 1
        else:
            if black_count > 0:
                white_count += 1

            rest_white -= 1
    print(ans)


if __name__ == '__main__':
    main()
