_,S = gets,-gets
c,l,r = 0,0,S.size-1
l += 1  while S[l] == ?R
r -= 1  while l<r && S[r] != ?R
while l < r
  c += 1
  l += 1
  r -= 1
  l += 1  while S[l] == ?R
  r -= 1  while l<r && S[r] != ?R
end
p c