'''
Created on 2020/08/22

@author: harurun
'''
def main():
  import sys
  pin=sys.stdin.readline
  pout=sys.stdout.write
  perr=sys.stderr.write
  
  N=int(pin())
  c=pin()[:-1]
  r=0
  w=0
  for i in c:
    if i=="R":
      r+=1
    else:
      w+=1
#  if r==N or w==N:
#    print(0)
#    return 
  nL=0
  nR=r 
  num=max(nL,nR)
  for i in c:
    if i=="R":
      nR-=1
    else:
      nL+=1
    if num>max(nL,nR):
      num=max(nL,nR)
  print(num)
  return 
main()
#解説AC '''
Created on 2020/08/22

@author: harurun
''' def main():
  import sys
  pin=sys.stdin.readline
  pout=sys.stdout.write
  perr=sys.stderr.write
  
  N=int(pin())
  c=pin()[:-1]
  r=0
  w=0
  for i in c:
    if i=="R":
      r+=1
    else:
      w+=1
#  if r==N or w==N:
#    print(0)
#    return 
  nL=0
  nR=r 
  num=max(nL,nR)
  for i in c:
    if i=="R":
      nR-=1
    else:
      nL+=1
    if num>max(nL,nR):
      num=max(nL,nR)
  print(num)
  return  main import sys sys pin=sys.stdin.readline pin sys.stdin.readline sys.stdin sys stdin readline pout=sys.stdout.write pout sys.stdout.write sys.stdout sys stdout write perr=sys.stderr.write perr sys.stderr.write sys.stderr sys stderr write N=int(pin()) N int(pin()) int pin() pin c=pin()[:-1] c pin()[:-1] () pin :-1 -1 r=0 r 0 w=0 w 0 for i in c:
    if i=="R":
      r+=1
    else:
      w+=1
#  if r==N or w==N:
#    print(0)
#    return 
   i c if i=="R":
      r+=1
    else:
      w+=1
#  if r==N or w==N:
#    print(0)
#    return 
   i=="R" i "R" r+=1 r 1 w+=1 w 1 nL=0 nL 0 nR=r nR r num=max(nL,nR) num max(nL,nR) max nL nR for i in c:
    if i=="R":
      nR-=1
    else:
      nL+=1
    if num>max(nL,nR):
      num=max(nL,nR)
   i c if i=="R":
      nR-=1
    else:
      nL+=1
     i=="R" i "R" nR-=1 nR 1 nL+=1 nL 1 if num>max(nL,nR):
      num=max(nL,nR)
   num>max(nL,nR) num max(nL,nR) max nL nR num=max(nL,nR) num max(nL,nR) max nL nR print(num) print num return main() main def main():
  import sys
  pin=sys.stdin.readline
  pout=sys.stdout.write
  perr=sys.stderr.write
  
  N=int(pin())
  c=pin()[:-1]
  r=0
  w=0
  for i in c:
    if i=="R":
      r+=1
    else:
      w+=1
#  if r==N or w==N:
#    print(0)
#    return 
  nL=0
  nR=r 
  num=max(nL,nR)
  for i in c:
    if i=="R":
      nR-=1
    else:
      nL+=1
    if num>max(nL,nR):
      num=max(nL,nR)
  print(num)
  return  def main():
  import sys
  pin=sys.stdin.readline
  pout=sys.stdout.write
  perr=sys.stderr.write
  
  N=int(pin())
  c=pin()[:-1]
  r=0
  w=0
  for i in c:
    if i=="R":
      r+=1
    else:
      w+=1
#  if r==N or w==N:
#    print(0)
#    return 
  nL=0
  nR=r 
  num=max(nL,nR)
  for i in c:
    if i=="R":
      nR-=1
    else:
      nL+=1
    if num>max(nL,nR):
      num=max(nL,nR)
  print(num)
  return  main
'''
Created on 2020/08/22

@author: harurun
'''
def main():
  import sys
  pin=sys.stdin.readline
  pout=sys.stdout.write
  perr=sys.stderr.write
  
  N=int(pin())
  c=pin()[:-1]
  r=0
  w=0
  for i in c:
    if i=="R":
      r+=1
    else:
      w+=1
#  if r==N or w==N:
#    print(0)
#    return 
  nL=0
  nR=r 
  num=max(nL,nR)
  for i in c:
    if i=="R":
      nR-=1
    else:
      nL+=1
    if num>max(nL,nR):
      num=max(nL,nR)
  print(num)
  return 
main()
#解説AC