def main(s):
  a = 0 #r-w 
  b = 0 #w-r 
  for i in s:
    if i == "R":
      a += 1
  ans = max(a,b) #無しもしない場合操作最大値 
  for i in s:
    if i == "R":
      a -= 1
    else:
      b += 1
    now = max(a,b)
    ans = min(ans, now)
  print(ans)
  
if __name__ == '__main__':
  n = int(input())
  s = input()
  main(s) def main(s):
  a = 0 #r-w 
  b = 0 #w-r 
  for i in s:
    if i == "R":
      a += 1
  ans = max(a,b) #無しもしない場合操作最大値 
  for i in s:
    if i == "R":
      a -= 1
    else:
      b += 1
    now = max(a,b)
    ans = min(ans, now)
  print(ans)
   main a = 0 a 0 b = 0 b 0 for i in s:
    if i == "R":
      a += 1
   i s if i == "R":
      a += 1
   i == "R" i "R" a += 1 a 1 ans = max(a,b) ans max(a,b) max a b for i in s:
    if i == "R":
      a -= 1
    else:
      b += 1
    now = max(a,b)
    ans = min(ans, now)
   i s if i == "R":
      a -= 1
    else:
      b += 1
     i == "R" i "R" a -= 1 a 1 b += 1 b 1 now = max(a,b) now max(a,b) max a b ans = min(ans, now) ans min(ans, now) min ans now print(ans) print ans s s if __name__ == '__main__':
  n = int(input())
  s = input()
  main(s) __name__ == '__main__' __name__ '__main__' n = int(input()) n int(input()) int input() input s = input() s input() input main(s) main s n = int(input()) int(input()) n def main(s):
  a = 0 #r-w 
  b = 0 #w-r 
  for i in s:
    if i == "R":
      a += 1
  ans = max(a,b) #無しもしない場合操作最大値 
  for i in s:
    if i == "R":
      a -= 1
    else:
      b += 1
    now = max(a,b)
    ans = min(ans, now)
  print(ans)
   def main(s):
  a = 0 #r-w 
  b = 0 #w-r 
  for i in s:
    if i == "R":
      a += 1
  ans = max(a,b) #無しもしない場合操作最大値 
  for i in s:
    if i == "R":
      a -= 1
    else:
      b += 1
    now = max(a,b)
    ans = min(ans, now)
  print(ans)
   main s = input() input() s
def main(s):
  a = 0 #r-w 
  b = 0 #w-r 
  for i in s:
    if i == "R":
      a += 1
  ans = max(a,b) #無しもしない場合操作最大値 
  for i in s:
    if i == "R":
      a -= 1
    else:
      b += 1
    now = max(a,b)
    ans = min(ans, now)
  print(ans)
  
if __name__ == '__main__':
  n = int(input())
  s = input()
  main(s)