Imports System

Module Program
    Sub Main(args As String())

        Dim N As Integer = Integer.Parse(Console.ReadLine())
        Dim c As String = Console.ReadLine()
        Dim r As Integer = 0
        Dim w As Integer = 0
        Dim bw As Integer = 0
        Dim ar As Integer = 0
        Dim ans As Integer = 0

        For i As Integer = 0 To N - 1
            If c(i) = "R" Then
                r += 1
            Else
                w += 1
            End If
        Next

        If r = 0 Or w = 0 Then
            ans = 0
        Else
            Dim i As Integer = 0
            Dim j As Integer = N - 1
            Do
                Dim we As Boolean = False
                Do
                    If c(i) = "W" Then
                        we = True
                        Exit Do
                    End If
                    If i >= j Then Exit Do
                    i += 1
                Loop
                Dim re As Boolean = False
                Do
                    If c(j) = "R" Then
                        re = True
                        Exit Do
                    End If
                    If i >= j Then Exit Do
                    j -= 1
                Loop
                If i < j AndAlso we And re Then
                    ans += 1
                    i += 1
                    j -= 1
                End If
                If i >= j Then Exit Do
            Loop
        End If

        Console.WriteLine(ans)

    End Sub
End Module
