import Control.Monad
import Data.Maybe
import qualified Data.ByteString.Char8 as BS
import qualified Data.Vector as V

main = abc162d

abc162d = do
    [n] <- getIntList
    s <- BS.getLine
    let rgbV = convRGB s (V.empty, V.empty, V.empty)
    print $ solveD rgbV

convRGB s (r,g,b)
    | BS.null s = (r,g,b)
    | BS.head s == 'R' = (V.cons n r,g,b)
    | BS.head s == 'G' = (r,V.cons n g,b)
    | BS.head s == 'B' = (r,g,V.cons n b)
    where n = V.length r + V.length g + V.length b + 1

solveD (r,g,b) = foldl' (\acc (x,y,z) -> if abs (x-y) == abs (x-z) then acc else acc+1) 0 (V.zip3 r g b)

gcd3List k = [getGCD3 (a,b,c) | a <- [1..k], b <- [1..k], c <- [1..k]]

readInt = fst . fromJust . BS.readInteger
readIntList = map readInt . BS.words
getIntList = readIntList <$> BS.getLine