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

    white = stones(S, ".", "#")
    black = stones(S, "#", ".")

    print(min([white, black]))


def stones(S, color, another):
    # ある色にする
    pre_stone = color
    color_count = 0
    for s in S:
        if pre_stone == color and s == another:
            color_count += 1
            pre_stone = color
        else:
            pre_stone = s

    # 後ろから黒が連続している数
    temp = S
    temp.reverse()

    con_another = 0
    for s in temp:
        if s == another:
            con_another += 1
        else:
            break

    color_count -= con_another
    return color_count


if __name__ == '__main__':
    main()
