P27033 [AtCoder] Stones
普及
题目描述

Problem Description

$ N $ stones are arranged in a row, and each stone is painted either white or black. The state of the stones is represented by a string $ S $ of length $ N $, where the $ i $-th character of $ S $ is . if the $ i $-th stone from the left is white, and # if it is black.

Takahashi wants to change the color of zero or more stones to black or white so that there are no white stones immediately to the right of any black stones. Find the minimum number of stones that need to be changed.

Input Format

The input is given from the standard input in the following format:

$ N $ $ S $

Output Format

Output the minimum number of stones that need to be changed.

Sample Input and Output

Sample Input #1

3
#.#

Sample Output #1

1

Sample Input #2

5
#.##.

Sample Output #2

2

Sample Input #3

9
.........

Sample Output #3

0

Notes/Hints

Constraints

  • $1 \leq N \leq 2 \times 10^5$
  • $ S $ is a string of length $ N $ consisting only of characters . and #

Sample Explanation 1

For example, changing the color of the 1st stone to white is sufficient.

输入格式

见题面 Input 部分

输出格式

见题面 Output 部分

样例输入
3 #.#
样例输出
1