func main(input1: String = readLine()!, input2: String = readLine()!) {
    let stones = input2.map { $0 }
    var wCount = 0
    var rCount = 0
    for stone in stones {
        switch stone {
        case "W":
            wCount += 1
        default:
            rCount += 1
        }
    }
    if wCount == 0 || rCount == 0 || (wCount == 1 && stones.last == "W") || (rCount == 1 && stones.first == "R") {
        return print(0)
    } else if wCount == 1 || rCount == 1 {
        return print(1)
    }
    var count = 0
    var leftMarker = stones.startIndex
    var rightMarker = stones.endIndex - 1
    
    while leftMarker < rightMarker {
        if stones[leftMarker] == "R" {
            leftMarker += 1
            continue
        }
        while stones[rightMarker] == "W" {
            rightMarker -= 1
            if leftMarker >= rightMarker {
                break
            }
        }
        count += 1
        leftMarker += 1
        rightMarker -= 1
    }
    print(count)
}

main()