import java.util.*
import javax.print.attribute.IntegerSyntax
import kotlin.math.*

private fun readLn() = readLine()!! // string line
private fun readInt() = readLn().toInt() // single int
private fun readLong() = readLn().toLong() // single long
private fun readStrings() = readLn().split(" ") // list of strings
private fun readInts() = readStrings().map(String::toInt) // list of ints
private fun readLongs() = readStrings().map(String::toLong) // list of longs

fun main() {
    val n = readInt()
    val c0 = readLn().toCharArray()
    val c = c0.map {
        if (it == 'W') 0 else 1
    }.toIntArray()

//    val rCount: Int = c.sum()
//    val wCount: Int = c.size - rCount

    var r = 0

    var leftWhite = c.indexOfFirst { it == 0 }
    var rightRed = c.indexOfLast { it == 1 }

    while (true) {
        if (leftWhite == -1 || rightRed == -1 || leftWhite == n || leftWhite > rightRed) {
            println(r)
            break
        }
        c[leftWhite] = 1
        c[rightRed] = 0
        r++

        while (leftWhite < n && c[leftWhite] != 0) {
            leftWhite++
        }
        while (rightRed >= 0 && c[rightRed] != 1) {
            rightRed--
        }
    }
}
