n = int(input())
s = input()

def counting_distance(s1, s2):
    count = 0
    for i in range(len(s1)):
        if s1[i] != s2[i]:
            count += 1
    return count

white = s.count('.')
black = n - white

list_dist = []
s_changed = '.' * white + '#' * black
dist_tmp = counting_distance(s, s_changed)
list_dist.append(counting_distance(s, s_changed))

if black < white:
    for i in range(white, n):
        if s[i] ==  s_changed[i]:
            dist_tmp += 1
        else:
            dist_tmp -= 1
        list_dist.append(dist_tmp)
elif black > white:
    for i in reversed(range(0, white)):
        if s[i] == s_changed[i]:
            dist_tmp += 1
        else:
            dist_tmp -= 1
        list_dist.append(dist_tmp)
else:
    for i in range(white, n):
        if s[i] ==  s_changed[i]:
            dist_tmp += 1
        else:
            dist_tmp -= 1
        list_dist.append(dist_tmp)
    dist_tmp = counting_distance(s, s_changed)
    for i in reversed(range(0, white)):
        if s[i] == s_changed[i]:
            dist_tmp += 1
        else:
            dist_tmp -= 1
        list_dist.append(dist_tmp)

print(min(list_dist))
