def main():
    N = int(input())
    S = [str(i) for i in input()]

    black_num = 0
    white_num = 0

    last_color = "black"

    for s in S:
        if s == "#":
            black_num += 1
            last_color = "black"
        elif s == ".":
            white_num += 1
            last_color = "white"

    if N != black_num + white_num:
        print("error")
        return

    if last_color == "black":
        black_num -= 1

    print(min([black_num, white_num]))


if __name__ == '__main__':
    main()
