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('.')
    ans = total_white
    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
                ans = min(ans, current_ans + white_count + rest_white)
                current_ans += (black_count - 1)
                white_count = 0
                black_count = 1
        else:
            if black_count > 0:
                white_count += 1
            # print('w')
            rest_white -= 1
    print(ans)

if __name__ == '__main__':
    main()
