def main():
    _ = int(input())
    S = input()
    ri = S.count("R")  # 右側の換えるべき個数
    le = 0
    ans = max(ri, le)
    for s in S:
        if s == "R":
            ri -= 1
        else:
            le += 1
        ans = min(ans, max(ri, le))
    print(ans)


if __name__ == '__main__':
    main() def main():
    _ = int(input())
    S = input()
    ri = S.count("R")  # 右側の換えるべき個数
    le = 0
    ans = max(ri, le)
    for s in S:
        if s == "R":
            ri -= 1
        else:
            le += 1
        ans = min(ans, max(ri, le))
    print(ans) main _ = int(input()) _ int(input()) int input() input S = input() S input() input ri = S.count("R") ri S.count("R") S.count S count "R" le = 0 le 0 ans = max(ri, le) ans max(ri, le) max ri le for s in S:
        if s == "R":
            ri -= 1
        else:
            le += 1
        ans = min(ans, max(ri, le))
     s S if s == "R":
            ri -= 1
        else:
            le += 1
         s == "R" s "R" ri -= 1 ri 1 le += 1 le 1 ans = min(ans, max(ri, le)) ans min(ans, max(ri, le)) min ans max(ri, le) max ri le print(ans) print ans if __name__ == '__main__':
    main() __name__ == '__main__' __name__ '__main__' main() main def main():
    _ = int(input())
    S = input()
    ri = S.count("R")  # 右側の換えるべき個数
    le = 0
    ans = max(ri, le)
    for s in S:
        if s == "R":
            ri -= 1
        else:
            le += 1
        ans = min(ans, max(ri, le))
    print(ans) def main():
    _ = int(input())
    S = input()
    ri = S.count("R")  # 右側の換えるべき個数
    le = 0
    ans = max(ri, le)
    for s in S:
        if s == "R":
            ri -= 1
        else:
            le += 1
        ans = min(ans, max(ri, le))
    print(ans) main
def main():
    _ = int(input())
    S = input()
    ri = S.count("R")  # 右側の換えるべき個数
    le = 0
    ans = max(ri, le)
    for s in S:
        if s == "R":
            ri -= 1
        else:
            le += 1
        ans = min(ans, max(ri, le))
    print(ans)


if __name__ == '__main__':
    main()
