import Control.Monad
import Data.Array

solver_l::Array Int Char ->Int->[(Char,String)]->Int
solver_l ar i [] = 0
solver_l ar i ((c,d):xs) = if i> snd (bounds ar)
                           then 0
                           else if not (ar!i==c && d == "L")
                                then solver_l ar i xs
                                else 1 + (solver_l ar (i+1) xs)

solver_r::Array Int Char ->Int->[(Char,String)]->Int
solver_r ar j [] = 0
solver_r ar j ((c,d):xs) = if j< fst (bounds ar)
                           then 0
                           else if not (ar!j==c && d == "R")
                                then solver_r ar j xs
                                else 1 + (solver_r ar (j-1) xs)

main::IO()
main=do
  (n:q:_)<-return.map read.words=<<getLine
  str<-getLine
  dat<-forM [1..q] (\_->return.(\ (t:d:_) -> (head t,d)).words=<<getLine)
  let ar = listArray (1,n) str
  let erase_l = solver_l ar 1 (reverse dat)
  let erase_r = solver_r ar n (reverse dat)
  print (n - (erase_l + erase_r) )