import kotlin.math.min

fun main() = Thread(null, ::abc174d, "(^o^)", 128 * 1024 * 1024).apply { start() }.join()

@OptIn(ExperimentalStdlibApi::class)
fun abc174d() {
    val n = readLine()!!.toInt()
    val line = readLine()!!

    val firstR = line.indexOf("R")
    val lastW = line.indexOf("W")

    val wCount = line.count { it == 'W' }
    val rCount = line.count { it == 'R' }
    val answer = if (wCount == 0 || rCount == 0) 0 else {
        minOf(wCount, rCount, min(
            line.slice(0 until rCount).count { it == 'W' },
            line.slice((line.lastIndex - wCount + 1)..line.lastIndex).count { it == 'R' }
        ))
    }

    println(answer)
}
