# -*- coding: utf-8 -*-
"""
@author: H_Hoshigi
22min 30sec WA
"""

def main():
    N = int(input())
    S = input()
    S += "#"

    answer = 0
    hash_counter = 0
    dot_counter = 0
    for i in range(N+1):
        if S[i] == "#":
            if dot_counter >= 1:
                answer += min(hash_counter, dot_counter)
                hash_counter = 1
                dot_counter = 0
            else:
                hash_counter += 1
        elif hash_counter >= 1:
            dot_counter += 1
    print(answer)

if __name__ == "__main__":
    main()

