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 if (ar!i==c && d == "R")
                                     then  solver_l ar (max (fst (bounds ar)) (i-1)) 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 if (ar!j==c && d == "L")
                                     then solver_r ar (min (snd (bounds ar)) (j+1)) xs
                                     else 1 + (solver_r ar (j-1) xs)

solver::Array Int Char -> Int -> Int ->[(Char,String)]->Int
solver ar i j [] = 0
solver ar i j ((c,d):xs) = if j<i
                           then 0
                           else if not ((ar!i==c && d == "L")||(ar!j==c && d == "R"))
                                then if not ((ar!i==c && d == "R")||(ar!j==c && d == "L"))
                                     then  (solver ar i j xs)
                                     else if d == "R"
                                          then solver ar (max (fst (bounds ar)) (i-1)) j xs
                                          else solver ar i (min (snd (bounds ar)) (j+1)) xs
                                else if d == "L"
                                     then 1 + (solver ar (i+1) j xs)
                                     else 1 + (solver ar i (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)
  let erase_ = solver ar 1 n (reverse dat)
  print (n - (erase_l + erase_r))