import java.util.Scanner

case class Input(cxs: List[Boolean]) {
  private def aux(cxs: List[Boolean], acc: Int): Int = cxs match {
    case Nil => acc
    case h :: Nil => acc
    case b1 :: b2 :: rst => if (b1 ^ b2) aux(rst, acc + 1)
                            else aux(b2::rst, acc)
  }
  def solved: Output = {
    Output(aux(this.cxs, 0))
  }
}

object Input {
  def fromString(s: String): Input =
    Input(s.toCharArray().map(_ == 'O').toList)
  def fromStdin(): Input = {
    val sc = new Scanner(System.in)
    sc.nextLine()
    Input.fromString(sc.nextLine())
  }
}

case class Output(v: Int) {
  override def toString(): String = {
    v.toString()
  }

  def print() = println(this.toString())
}

object Main extends App {
  Input.fromStdin().solved.print()
}

