# -*- coding: utf-8 -*-
N =  input()
S =  input()
t = "."
bef = 0
c = 0
ans = 0
for s in S[1:]:
  if  s != t:
    t = s
    ans += min(c, bef)
    bef = c
    c = 0
  else:
    c += 1

if(t == "."):
  ans += min(c, bef)
print(ans)