/*#include<stdio.h>
#include<string.h>
int main()
{
int n,b[2]={},a=0,z=0,i;
char str[500000]={},t1,t2;
scanf("%d",&n);
scanf("%s",str);
for(i=0;i<n;i++)
{
if(str[i]=='R'){b[0]++;}
else{b[1]++;}
}
if(b[0]==n||b[1]==n){printf("0");}
else
{
i=0;t1=str[i];
while(1)
{
if(i>=n){break;}
if(str[i]==t1){a++;}
else{break;}
i++;
}
i=n-1;t2=str[i];
while(1)
{
if(i<0){break;}
if(str[i]==t2){z++;}
else{break;}
i--;
}
if(t1==t2)
{
printf("%d",(((t1=='R'?b[0]:b[1])-(a>z?a:z))<(t1=='R'?b[1]:b[0]))?(t1=='R'?b[0]:b[1])-(a>z?a:z):t1=='R'?b[1]:b[0]);
}
else
{
printf("%d",((t1=='R'?b[0]:b[1])-a)<((t2=='R'?b[0]:b[1])-z)?((t1=='R'?b[0]:b[1])-a):((t2=='R'?b[0]:b[1])-z));
}
}
return 0;
}*/