from sys import stdin
input = stdin.readline


def main():
  N = int(input())
  S = input()[:-1]

  pre = S[0]
  cnt = 1
  for i in range(1, N):
    if pre == S[i]:
      pre = S[i]
      continue
    cnt += 1
    pre = S[i]
  print(cnt)


if(__name__ == '__main__'):
  main() from sys import stdin input = stdin.readline input stdin.readline stdin readline def main():
  N = int(input())
  S = input()[:-1]

  pre = S[0]
  cnt = 1
  for i in range(1, N):
    if pre == S[i]:
      pre = S[i]
      continue
    cnt += 1
    pre = S[i]
  print(cnt) main N = int(input()) N int(input()) int input() input S = input()[:-1] S input()[:-1] () input :-1 -1 pre = S[0] pre S[0] S 0 cnt = 1 cnt 1 for i in range(1, N):
    if pre == S[i]:
      pre = S[i]
      continue
    cnt += 1
    pre = S[i]
   i range(1, N) range 1 N if pre == S[i]:
      pre = S[i]
      continue
     pre == S[i] pre S[i] S i pre = S[i] pre S[i] S i continue cnt += 1 cnt 1 pre = S[i] pre S[i] S i print(cnt) print cnt if(__name__ == '__main__'):
  main() __name__ == '__main__' __name__ '__main__' main() main def main():
  N = int(input())
  S = input()[:-1]

  pre = S[0]
  cnt = 1
  for i in range(1, N):
    if pre == S[i]:
      pre = S[i]
      continue
    cnt += 1
    pre = S[i]
  print(cnt) def main():
  N = int(input())
  S = input()[:-1]

  pre = S[0]
  cnt = 1
  for i in range(1, N):
    if pre == S[i]:
      pre = S[i]
      continue
    cnt += 1
    pre = S[i]
  print(cnt) main input = stdin.readline stdin.readline input
from sys import stdin
input = stdin.readline


def main():
  N = int(input())
  S = input()[:-1]

  pre = S[0]
  cnt = 1
  for i in range(1, N):
    if pre == S[i]:
      pre = S[i]
      continue
    cnt += 1
    pre = S[i]
  print(cnt)


if(__name__ == '__main__'):
  main()
