if __name__ == '__main__':
    """
    #.##...
    """
    n = int(input())
    s = input()
    s = s[:n]

    try:
        first_black = s.index('#')
    except ValueError as e:
        print(0)
        exit(0)

    s2 = s[first_black+1:]
    white_to_black = s2.count('.')
    s.count('#')
    lastb = 0
    for i in reversed(range(len(s))):
        if s[i] == '#':
            lastb += 1
        else:
            break

    black_to_white = s.count('#') - lastb
    print(min(black_to_white, s2.count('.')))
