import numpy as np
N = int(input())
S = input()
x = []
xp = '#'
c = 0
for n in range(N):
    if S[n] == xp:
        c += 1
    else:
        xp = S[n]
        x.append(c)
        c = 1
x.append(c)
if len(x) % 2 != 0:
    x.append(0)
x = np.array(x)
x = np.reshape(x, (-1,2)).T
y = [sum(x[0,:n])+sum(x[1,n:]) for n in range(x.shape[1]+1)]
print(min(y))