import qualified Data.Text as T
import qualified Data.Text.IO as T
import qualified Data.Text.Read as T
import Data.Sequence (Seq)
import qualified Data.Sequence as S

main :: IO ()
main = do
  let
    go :: Int -> Seq Bool -> Int
    go k xs | S.null xs = k
    go k xs = go (k + 1) xs'''
      where
        _ S.:< xs' = S.viewl xs
        xs'' S.:> _ = S.viewr xs'
        xs''' = S.dropWhileR not . S.dropWhileL id $ xs''
  n <- unsafeTextToInt <$> T.getLine :: IO Int
  cs <- map (== 'R') <$> getLine :: IO [Bool]
  let
    cs' = S.dropWhileR not . S.dropWhileL id . S.fromList $ cs :: Seq Bool
  print . go 0 $ cs'

unsafeTextToInt :: T.Text -> Int
unsafeTextToInt s = case T.signed T.decimal s of
  Right (n, _) -> n
{-# INLINE unsafeTextToInt #-}
