# import sys
# input = sys.stdin.readline
import collections

def main():
    n = int(input())
    s = input()
    a_list = []
    for i in range(n):
        if s[i] == "W":
            a_list.append(0)
        else:
            a_list.append(1)
    r_count = sum(a_list)
    print(r_count - sum(a_list[0:r_count]))


def input_list():
    return list(map(int, input().split()))


def input_list_str():
    return list(map(str, input().split()))


if __name__ == "__main__":
    main() import collections collections def main():
    n = int(input())
    s = input()
    a_list = []
    for i in range(n):
        if s[i] == "W":
            a_list.append(0)
        else:
            a_list.append(1)
    r_count = sum(a_list)
    print(r_count - sum(a_list[0:r_count])) main n = int(input()) n int(input()) int input() input s = input() s input() input a_list = [] a_list [] for i in range(n):
        if s[i] == "W":
            a_list.append(0)
        else:
            a_list.append(1)
     i range(n) range n if s[i] == "W":
            a_list.append(0)
        else:
            a_list.append(1)
     s[i] == "W" s[i] s i "W" a_list.append(0) a_list.append a_list append 0 a_list.append(1) a_list.append a_list append 1 r_count = sum(a_list) r_count sum(a_list) sum a_list print(r_count - sum(a_list[0:r_count])) print r_count - sum(a_list[0:r_count]) r_count sum(a_list[0:r_count]) sum a_list[0:r_count] a_list 0:r_count 0 r_count def input_list():
    return list(map(int, input().split())) input_list return list(map(int, input().split())) list(map(int, input().split())) list map(int, input().split()) map int input().split() ().split () input split def input_list_str():
    return list(map(str, input().split())) input_list_str return list(map(str, input().split())) list(map(str, input().split())) list map(str, input().split()) map str input().split() ().split () input split if __name__ == "__main__":
    main() __name__ == "__main__" __name__ "__main__" main() main def input_list():
    return list(map(int, input().split())) def input_list():
    return list(map(int, input().split())) input_list def input_list_str():
    return list(map(str, input().split())) def input_list_str():
    return list(map(str, input().split())) input_list_str def main():
    n = int(input())
    s = input()
    a_list = []
    for i in range(n):
        if s[i] == "W":
            a_list.append(0)
        else:
            a_list.append(1)
    r_count = sum(a_list)
    print(r_count - sum(a_list[0:r_count])) def main():
    n = int(input())
    s = input()
    a_list = []
    for i in range(n):
        if s[i] == "W":
            a_list.append(0)
        else:
            a_list.append(1)
    r_count = sum(a_list)
    print(r_count - sum(a_list[0:r_count])) main
# import sys
# input = sys.stdin.readline
import collections

def main():
    n = int(input())
    s = input()
    a_list = []
    for i in range(n):
        if s[i] == "W":
            a_list.append(0)
        else:
            a_list.append(1)
    r_count = sum(a_list)
    print(r_count - sum(a_list[0:r_count]))


def input_list():
    return list(map(int, input().split()))


def input_list_str():
    return list(map(str, input().split()))


if __name__ == "__main__":
    main()
