/*                   
                                             ::                     ::       
                                             ':                     :        
                                              :.                    :        
                                           ;' ::                   ::  '     
                                          .'  ';                   ;'  '.    
                                         ::    :;                 ;:    ::   
                                         ;      :;.             ,;:     ::   
                                         :;      :;:           ,;"      ::   
                                         ::.      ':;  ..,.;  ;:'     ,.;:   
                                          "'"...   '::,::::: ;:   .;.;""'    
                                              '"""....;:::::;,;.;"""         
                                          .:::.....'"':::::::'",...;::::;.   
                                         ;:' '""'"";.,;:::::;.'""""""  ':;   
                                        ::'         ;::;:::;::..         :;  
                                       ::         ,;:::::::::::;:..       :: 
                                       ;'     ,;;:;::::::::::::::;";..    ':.
                                      ::     ;:"  ::::::"""'::::::  ":     ::
                                       :.    ::   ::::::;  :::::::   :     ; 
                                        ;    ::   :::::::  :::::::   :    ;  
                                         '   ::   ::::::....:::::'  ,:   '   
                                          '  ::    :::::::::::::"   ::       
                                             ::     ':::::::::"'    ::       
                                             ':       """""""'      ::       
                                              ::                   ;:        
                                              ':;                 ;:"        


                                                     P_r_A_d_Y
*/
#include<bits/stdc++.h>
using namespace std;
#define int long long int
#define endl "\n"
#define mod 1000000007
#define inf 1e18
const int N = 300005;
#define fastIO ios_base::sync_with_stdio(false); cin.tie(NULL);
void cs(int &x)
{
  cout<<"Case #"<<x<<": ";
}
bool cmp(int a,int b)
{
  return a>b;
}
int32_t main()
{
  fastIO;
  // int t;cin>>t;
  // int x=1;
  // while(t--)
  // {
     int n;cin >> n;
     string s;cin >> s;

     //int c=INT_MAX;
     vector<int>repr(n,0),repw(n,0);
     repr[n-1]=1;
     if(s[n-1]=='W')
      repr[n-1]=0;
     for(int i=n-2;i>=0;i--)
        {
          if(s[i]=='R')
            repr[i]=1+repr[i+1];
          else
            repr[i]=repr[i+1];
        }
      repw[0]=1;
      if(s[0]=='R')
        repw[0]=0;

      for(int i=1;i<n;i++)
      {
        if(s[i]=='W')
            repw[i]=1+repw[i-1];
          else
            repw[i]=repw[i-1];
      }
      int c=0;
      int i=0,j=n-1;
      while(i<j)
      {

        //cout<<i<<" "<<j<<endl;
        while(i<j && repr[j]==c)
          j--;

        while(i<j && repw[i]==c)
          i++;

        //cout<<i<<" "<<j<<endl;

        if(i<j)
        c++;
      }

      cout<<c<<endl;


     

  //}
  return 0;
}

Measured memory_bytes: 6756