func main(input1: String = readLine()!, input2: String = readLine()!) {
    var stones = input2.map { $0 }
    var count = 0
    var rightMarker = stones.endIndex
    for wPosition in 0..<stones.endIndex where stones[wPosition] == "W" {
        guard wPosition < rightMarker else { break }
        rLoop: for rPosition in ((wPosition + 1)..<rightMarker).reversed() where stones[rPosition] == "R" {
            stones.swapAt(wPosition, rPosition)
            rightMarker = rPosition
            count += 1
            break rLoop
        }
    }
    print(count)
}

main()