import scala.annotation.tailrec

object Main extends App {
  import scala.io.StdIn._
  import scala.math._
  val n = readInt()
  val files = List.fill(n){
    val Array(d, l) = readLine.trim.split(' ')
    (d == "y", l.toInt)
  }
  val sanitized = sanitize(files)
  val isRemoved = Array.fill(sanitized.length){false}
  var count = 0
  for (i ← sanitized.indices.filter(i ⇒ sanitized(i)._1).sortBy(i ⇒ sanitized(i)._2) if !isRemoved(i)) {
    count += 1
    val deleteLen = sanitized(i)._2
    var left = i
    var right = i
    while (sanitized.indices.contains(left) && (sanitized(left)._1 || sanitized(left)._2 < deleteLen)) {
      isRemoved(left) = true
      left -= 1
    }
    while (sanitized.indices.contains(right) && (sanitized(right)._1 || sanitized(right)._2 < deleteLen)) {
      isRemoved(right) = true
      right += 1
    }
  }
  println(count)
  @tailrec def sanitize(file: List[(Boolean, Int)], result: List[(Boolean, Int)] = Nil): Array[(Boolean, Int)] = {
    (file, result) match {
      case (Nil, _) ⇒ result.reverse.toArray
      case ((f@(true, _))::r, Nil) ⇒ sanitize(r, f::result)
      case (_::r, Nil) ⇒ sanitize(r, Nil)
      case ((true, l)::fr, (true, r)::rr) ⇒ sanitize(fr, (true, min(l, r))::rr)
      case ((false, l)::fr, (false, r)::rr) ⇒ sanitize(fr, (false, max(l, r))::rr)
      case (f::fr, _) ⇒ sanitize(fr, f::result)
    }
  }
}

