import java.io.BufferedReader
import java.io.InputStreamReader
import java.util.*

fun main() {
    val jin = BufferedReader(InputStreamReader(System.`in`))
    val n = jin.readLine().toInt()
    val colors = jin.readLine()
    val white = LinkedList<Int>()
    for (j in 0 until n) {
        if (colors[j] == 'W') {
            white.add(j)
        }
    }
    var answer = 0
    for (j in n - 1 downTo 0) {
        if (colors[j] == 'R' && white.isNotEmpty() && white[0] < j) {
            white.removeFirst()
            answer++
        }
    }
    println(answer)
}