def main():
    n = int(input())
    c = str(input())

    w_count = 0
    for i in range(n):
        if c[i] == 'W':
            w_count += 1

    w_count_ano = 0
    for i in range(w_count):
        if c[- 1 - i] == 'W':
            w_count_ano += 1

    count = w_count - w_count_ano
    print(count)


if __name__ == '__main__':
    main() def main():
    n = int(input())
    c = str(input())

    w_count = 0
    for i in range(n):
        if c[i] == 'W':
            w_count += 1

    w_count_ano = 0
    for i in range(w_count):
        if c[- 1 - i] == 'W':
            w_count_ano += 1

    count = w_count - w_count_ano
    print(count) main n = int(input()) n int(input()) int input() input c = str(input()) c str(input()) str input() input w_count = 0 w_count 0 for i in range(n):
        if c[i] == 'W':
            w_count += 1

     i range(n) range n if c[i] == 'W':
            w_count += 1

     c[i] == 'W' c[i] c i 'W' w_count += 1 w_count 1 w_count_ano = 0 w_count_ano 0 for i in range(w_count):
        if c[- 1 - i] == 'W':
            w_count_ano += 1

     i range(w_count) range w_count if c[- 1 - i] == 'W':
            w_count_ano += 1

     c[- 1 - i] == 'W' c[- 1 - i] c - 1 - i - 1 i 'W' w_count_ano += 1 w_count_ano 1 count = w_count - w_count_ano count w_count - w_count_ano w_count w_count_ano print(count) print count if __name__ == '__main__':
    main() __name__ == '__main__' __name__ '__main__' main() main def main():
    n = int(input())
    c = str(input())

    w_count = 0
    for i in range(n):
        if c[i] == 'W':
            w_count += 1

    w_count_ano = 0
    for i in range(w_count):
        if c[- 1 - i] == 'W':
            w_count_ano += 1

    count = w_count - w_count_ano
    print(count) def main():
    n = int(input())
    c = str(input())

    w_count = 0
    for i in range(n):
        if c[i] == 'W':
            w_count += 1

    w_count_ano = 0
    for i in range(w_count):
        if c[- 1 - i] == 'W':
            w_count_ano += 1

    count = w_count - w_count_ano
    print(count) main
def main():
    n = int(input())
    c = str(input())

    w_count = 0
    for i in range(n):
        if c[i] == 'W':
            w_count += 1

    w_count_ano = 0
    for i in range(w_count):
        if c[- 1 - i] == 'W':
            w_count_ano += 1

    count = w_count - w_count_ano
    print(count)


if __name__ == '__main__':
    main()