N = int(input())
S = input()
cnts = []
cnt = 0
for i in range(N):
  if i == 0:
    prvs = S[i]
    cnt += 1
  else:
    if S[i]==prvs:
      cnt += 1
    else:
      cnts.append([prvs,cnt])
      prvs = S[i]
      cnt = 1
  if i == N-1:
    cnts.append([prvs,cnt])
if len(cnts) == 1:
  print(0)
else:
  cntw,cntb = 0,0
  for i in range(len(cnts)):
    if (i == 0 and cnts[i][0]=='.') or (i == len(cnts)-1 and cnts[i][0]=='#'):
      continue
    if cnts[i][0]=='.':
      cntw += cnts[i][1]
    elif cnts[i][0]=='#':
      cntb += cnts[i][1]
  print(min(cntw,cntb))