import re


N = int(input())
S = input()
re_bwbbb = re.compile(r'#\.+#*$')
re_bw = re.compile(r'#\.+')
replace = 0

while len(S) > 0:
    match = re_bwbbb.search(S)
    if match is None:
        break

    sub_word = match.group(0)
    pattern = re_bw.match(sub_word).group(0)
    if pattern.count('.') > pattern.count('#'):
        replace += pattern.count('#')
    else:
        replace += pattern.count('.')
    
    S = S[0:-len(sub_word)]

print(replace)
