import java.util.*

fun main() {
    val n = readLine()?.toInt() ?: return
    val c = readLine() ?: return
    val w = LinkedList<Int>()
    val r = LinkedList<Int>()
    c.forEachIndexed { i, v ->
        when (v) {
            'W' -> {
                w.add(i)
            }
            'R' -> {
                r.add(i)
            }
        }
    }
    var count = 0
    while (true) {
        if (w.isNotEmpty() && r.isNotEmpty()) {
            val a = w.first
            val b = r.last
            if (a < b) {
                count++
                w.removeFirst()
                r.removeLast()
            } else {
                break
            }
        } else {
            break
        }
    }
    println(count.toString())
}