import Foundation

class Scanner {
    static func readInt() -> Int {
        return Int(readLine()!)!
    }
    
    static func readIntArr() -> [Int] {
        return readLine()!.split(separator: " ").map { Int($0)! }
    }
    
    static func readM(_ n: Int) -> [[Int]] {
        var res = [[Int]]()
        for _ in 0..<n {
            res.append(readIntArr())
        }
        return res
    }
    
    static func readUknownIntMat() -> [[Int]] {
        var res = [[Int]]()
        while let line = readLine() {
            res.append(line.split(separator: " ").map { Int($0)! })
        }
        return res
    }
    
    static func readString() -> String {
        return readLine()!
    }
}

class Printer {
    static func printIntArray(_ arr: [Int]) {
        print(arr.map { String($0) }.joined(separator: " "))
    }
}

class Solution {
    func minSwaps(_ str: String) -> Int {
        var res = 0, left = 0, right = str.count-1
        let str = Array(str)
        
        //WRWWRWRR
        while left<right {
            while left < right && str[left] != "W"  {
                left += 1
            }
            while right > left && str[right] != "R" {
                right -= 1
            }
            if str[left] == "W" && str[right] == "R" {
                res += 1
            }
            left += 1
            right -= 1
        }
        return res
    }
}


let n = Scanner.readInt()
let str = Scanner.readString()
print(Solution().minSwaps(str))
