unittest
{
	assert( [ "4", "WWRR" ].solve == 2 );
	assert( [ "2", "RR" ].solve == 0 );
	assert( [ "8", "WRWWRWRR" ].solve == 3 );
}



import std.conv;
import std.range;
import std.stdio;

void main()
{
	stdin.byLineCopy.solve.writeln;
}

auto solve( Range )( Range input )
if( isInputRange!Range && is( ElementType!Range == string ) )
{
	auto n = input.front.to!( long );
	input.popFront;
	auto cs = input.front.to!( dchar[] );
	
	auto ans = 0L;
	auto l = 0L;
	auto r = cs.length.signed - 1;
	while( l < r )
	{
		while( l < r && cs[ l ] == 'R' ) l++;
		while( l < r && cs[ r ] == 'W' ) r--;
		if( l < r )
		{
			ans++;
			l++;
			r--;
		}
	}
	return ans;
}
