n = int(input())
s = list(input())
c = 0
ran = []
i = 0
while i+c <= n:
    if i+c < n:
        if s[i] == s[c+i]:
            c += 1
        else:
            ran.append([s[i], c])
            i += c
            c = 0
    else:
        ran.append([s[i], c])
        c +=1
ran = ran[::-1]
# '#' is brack
result = []
if ran[0][0] == '#':
    counter_1 = 0
    counter_2 = 0
    for i in range(1, len(ran)):
        if i %2 == 0:
            counter_1 += ran[i][1]
        else:
            counter_2 += ran[i][1]
    print(min([counter_1, counter_2]))
else:
    counter_1 = 0
    counter_2 = 0
    for i in range(len(ran)):
        if i%2 == 0:
            counter_1 += ran[i][1]
        else:
            counter_2 += ran[i][1]
    print(min([counter_1, counter_2]))