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

# count '.'
count_wb = []
count = 0
for i in range(n):
    if s[i] == '.':
        count += 1
    count_wb.append((count, i+1-count, count - (i+1-count))) # (w, b, diff)

max_diff = max(count_wb[i][2] for i in range(n))

for i in range(n):
    if count_wb[i][2] == max_diff:
        print(count_wb[i][1] + count_wb[n-1][0] - count_wb[i][0])
