# 全て赤にする
# 全て白にする
# 垢を左に集める

def main():
    n = int(input())
    c = input()
    all_r = c.count('R')
    all_w = c.count('W')
    trade = all_r - c[:all_r].count('R')
    print(min(all_r,all_w,trade))

    return 

if __name__ == "__main__":
    main() def main():
    n = int(input())
    c = input()
    all_r = c.count('R')
    all_w = c.count('W')
    trade = all_r - c[:all_r].count('R')
    print(min(all_r,all_w,trade))

    return  main n = int(input()) n int(input()) int input() input c = input() c input() input all_r = c.count('R') all_r c.count('R') c.count c count 'R' all_w = c.count('W') all_w c.count('W') c.count c count 'W' trade = all_r - c[:all_r].count('R') trade all_r - c[:all_r].count('R') all_r c[:all_r].count('R') [:all_r].count [:all_r] c :all_r all_r count 'R' print(min(all_r,all_w,trade)) print min(all_r,all_w,trade) min all_r all_w trade return if __name__ == "__main__":
    main() __name__ == "__main__" __name__ "__main__" main() main def main():
    n = int(input())
    c = input()
    all_r = c.count('R')
    all_w = c.count('W')
    trade = all_r - c[:all_r].count('R')
    print(min(all_r,all_w,trade))

    return  def main():
    n = int(input())
    c = input()
    all_r = c.count('R')
    all_w = c.count('W')
    trade = all_r - c[:all_r].count('R')
    print(min(all_r,all_w,trade))

    return  main
# 全て赤にする
# 全て白にする
# 垢を左に集める

def main():
    n = int(input())
    c = input()
    all_r = c.count('R')
    all_w = c.count('W')
    trade = all_r - c[:all_r].count('R')
    print(min(all_r,all_w,trade))

    return 

if __name__ == "__main__":
    main()