Go: package main

import (
	"fmt"
	"strings"
)

func main() {
	var n int
	var s string
	_, _ = fmt.Scan(&n)
	_, _ = fmt.Scan(&s)
	fmt.Println(calc(s))
}

func calc(s string) int {
	sum := 0
	ss := strings.Split(s,"")
	bf := 0
	for _, v := range ss{
		if bf == 0 {
			bf = cnv(v)
		} else if bf != cnv(v) {
			sum++
			bf = 0
		}
	}
	return sum
}

func cnv(s string) int {
	switch s {
	case "O":
		return 1
	case "X":
		return 2
	}
	return 0
}

Python: #!/usr/bin/python3

import array
from fractions import Fraction
import functools
import itertools
import math
import os
import sys


def main():
    N = read_int()
    S = inp()
    print(solve(N, S))


def solve(N, S):
    i = 0
    count = 0
    while i < N - 1:
        if S[i] != S[i + 1]:
            count += 1
            i += 2
        else:
            i += 1
    return count


###############################################################################
# AUXILIARY FUNCTIONS

DEBUG = 'DEBUG' in os.environ


def inp():
    return sys.stdin.readline().rstrip()


def read_int():
    return int(inp())


def read_ints():
    return [int(e) for e in inp().split()]


def dprint(*value, sep=' ', end='\n'):
    if DEBUG:
        print(*value, sep=sep, end=end)


if __name__ == '__main__':
    main()

Python: N = int(input())
S = list(input())
cnt = 0

for i in range(N - 1) :
  if(S[i] == "O" and S[i + 1] == "X") :
    S[i] = "l"
    S[i + 1] = "l"
    cnt += 1
  elif(S[i] == "X" and S[i + 1] == "O") :
    S[i] = "l"
    S[i + 1] = "l"
    cnt += 1
  else :
    pass

print(cnt)

Python: N = int(input())
S = input()
dp = [0]*(N+1)
dp[0] = 0
for i in range(N):
    if i < N-1 and S[i] != S[i+1]:
        dp[i+2] = dp[i]+1
    dp[i+1] = max(dp[i+1], dp[i])
print(dp[N])

Python: input()
s = [i for i in input()]
cnt = 0
j = 0
for i in range(len(s)-1):
    if j == 1:
        j = 0
    elif s[i]+s[i+1] == 'OX' or s[i]+s[i+1] == 'XO':
        cnt += 1
        j = 1
print(cnt)

Python: N=int(input())
s=input()
n=0
cnt=0
while n<=len(s)-2:
    if s[n:n+2]=="OX"or s[n:n+2]=="XO":
        cnt+=1
        n+=2
    else:
        n+=1
print(cnt)

Python: n = int(input())
s = input()

ans, i = 0, 1
while i < n:
    if s[i-1] != s[i]:
        ans += 1
        i += 1
    
    i += 1

print(ans)

Python: # coding: utf-8
# Your code here!

#数学オリンピック_〇×スタンプ

kosu=int(input())

stamp=input()

i=0;
ans=0;

while i<len(stamp)-1:
    if stamp[i]!=stamp[i+1]:
        ans+=1
        i+=2
    else:
        i+=1

print(ans)

Python: #標準入力
i = int(input())
str1 = input()

#まるばつスタンプの数を数えまるばつスタンプを消す
i = str1.count("OX")
line = str1.split("OX")

#リストに残った要素で文字列を作り、ばつまるスタンプの数を数える
str2 = "".join(line)
print(i + str2.count("XO"))

Python: n = int(input())
s = input()
i = 0
x = 0
while i+1 < n:
    if s[i:i+2] in ['OX','XO']:
        i += 2
        x += 1
    else:
        i += 1
print(x)

Python: # coding: utf-8
n=int(input())
s=input()
dp=[0 for i in range(n)]
for i in range(1,n):
    if s[i-1]!=s[i]:
        dp[i]=max(dp[i-1],dp[i-2]+1 if i-2>=0 else 1)
    else:
        dp[i]=dp[i-1]
print(dp[-1])

Python: n=int(input())
s=list(input())
cnt=0
def jesus(a,b):
    if (a=='O' and b=='X') or (b=='O' and a=='X'):
        return True
    else:
        return False
i=0
while i+1<n:
    if jesus(s[i],s[i+1]):
        cnt+=1
        i+=1
    i+=1
print(cnt)

Python: n = int(input())
s = input()

i = 0
ans = 0
while i+1 < n:
    if s[i:i+2] in ['OX','XO']:
        i += 2
        ans += 1
    else:
        i += 1
print(ans)

Python: def main():
    N = int(input())
    S = input()
    pre = False
    ans = 0
    for i in range(N-1):
        if pre:
            pre = False
            continue
        if (S[i] == 'O' and S[i+1] == 'X') or (S[i] == 'X' and S[i+1] == 'O'):
            ans += 1
            pre = True
    print(ans)


if __name__ == '__main__':
    main()

Python: n=int(input())
s=input()

i,cnt=0,0
while i<n-1:
    t=s[i]+s[i+1]
    if t=="OX" or t=="XO":
        cnt+=1
        i+=1
    i+=1
print(cnt)

Python: def found_min(x, y):
    if x == -1 and y == -1:
        return -1
    elif x == -1:
        return y
    elif y == -1:
        return x
    else:
        if x >= y:
            return y
        else:
            return x
n = int(input())
Stamp = input()

OXStamp = 0
index = 0

while True:
    
    i = found_min(Stamp[index:].find("OX"), Stamp[index:].find("XO"))
    if i == -1:
        break
    else:
        OXStamp += 1
        index += i + 2
print(OXStamp)

Python: n = int(input())
s = input()

count = 0
flag = 0
for i in range(1, n):
    if flag==1:
        flag = 0
        continue
    if s[i-1] != s[i]:
        count += 1
        flag = 1
print(count)

Python: check = True
cnt = 0

n = int(input())
stamps = input()

while len(stamps)>1:
    if check:
        if stamps[:2] in ["XO", "OX"]:
            cnt += 1
            check = False
    else:
        check = True
    stamps = stamps[1:]

print(cnt)

Python: n=int(input())
s=input()
ans=0
ans+=s.count("OX")
s=s.replace('OX','')
ans+=s.count("XO")
print(ans)

Python: N = input("")
S = input("")

maru_batsu = 0
judge_skip = False
for index in range(1, int(N)):
    s0 = S[index - 1]
    s1 = S[index]
    if judge_skip == True:
        judge_skip = False
        continue
    if s0 != s1:
        maru_batsu += 1
        judge_skip = True
print(maru_batsu)

Python: N=int(input())
s=str(input())
S=[]
for i in s:
    S.append(i)

i=0
count=0
while i<N-1:
    if (S[i]=='O' and S[i+1]=='X') or (S[i]=='X' and S[i+1]=='O'):
        count+=1
        i+=2
    else:
        i+=1
print(count)

Python: n = int(input())
s = input()

i = 0
ans = 0
while i+1 < n:
    if s[i:i+2] in ['OX','XO']:

        i += 2
        ans += 1
    else:
        i += 1
print(ans)

Python: n = int(input())
s = input()
flag = 0
ans = 0
for i,v in enumerate(s):
    if i == 0:
        temp = v   
    else:
        if v != temp:
            if flag == 0:
                ans += 1
                flag = 1
            elif flag == 1:
                flag = 0
        else:
            if flag == 1:
                flag = 0
        temp = v

print(ans)

Python: N = int(input())
S = input()
cnt = 0
while N > 1:
    stamp = S[N-2:N]
    if stamp == "OX" or stamp == "XO":
        cnt += 1
        N -= 2
    else:
        N -= 1
print(cnt)

Python: #
# 　　  ⋀_⋀　 
#　　  (･ω･)  
# .／ Ｕ ∽ Ｕ＼
#  │＊　合　＊│
#  │＊　格　＊│ 
#  │＊　祈　＊│ 
#  │＊　願　＊│ 
#  │＊　　　＊│ 
#      ￣
#
import sys
sys.setrecursionlimit(10**6)
input=sys.stdin.readline
from math import floor,ceil,sqrt,factorial,log #log2ないｙｐ
from heapq import heappop, heappush, heappushpop
from collections import Counter,defaultdict,deque
from itertools import accumulate,permutations,combinations,product,combinations_with_replacement
from bisect import bisect_left,bisect_right
from copy import deepcopy
inf=float('inf')
mod = 10**9+7
def pprint(*A): 
    for a in A:     print(*a,sep='\n')
def INT_(n): return int(n)-1
def MI(): return map(int,input().split())
def MF(): return map(float, input().split())
def MI_(): return map(INT_,input().split())
def LI(): return list(MI())
def LI_(): return [int(x) - 1 for x in input().split()]
def LF(): return list(MF())
def LIN(n:int): return [I() for _ in range(n)]
def LLIN(n: int): return [LI() for _ in range(n)]
def LLIN_(n: int): return [LI_() for _ in range(n)]
def LLI(): return [list(map(int, l.split() )) for l in input()]
def I(): return int(input())
def F(): return float(input())
def ST(): return input().replace('\n', '')
def main():
    N = I()
    S = ST()+"//"
    i=0
    ans =0
    while i < N:
        if S[i:i+2] in ("OX","XO"):
            ans += 1
            i +=1
        i+=1
    print(ans)
if __name__ == '__main__':
    main()

Python: n = int(input())
s = input()
cnt = 0
i = 0
while i+1 < n:
    if s[i:i+2] in ['OX', 'XO']:
        cnt += 1
        i += 2
    else:
        i += 1
print(cnt)

Python: import re
input()
print(re.sub(r'OX|XO','@',input()).count('@'))