from sys import stdin

n = int(stdin.readline().rstrip())
s = stdin.readline().rstrip()



l = []
now = '.'
count = 0
for i in range(n):
  if ( s[i] != now ):
    l.append(count)
    now = s[i]
    count = 0
  count += 1

if ( count > 0 ):
  l.append(count)

#print(l)

ans = 99999
for i in range(len(l)):
  if ((i%2)!=0) :
    continue

  count = 0
  for j in range(int(i/2)):
    count += l[j*2+1]
  for j in range(int((len(l)-i-1)/2)):
    count += l[i+(j+1)*2]

  #print(i, count)

  if (ans>count):
    ans = count

print(ans)