using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;

class Program
{
    static void Main(string[] args)
    {
        var n = int.Parse(Console.ReadLine());

        var str = Console.ReadLine().ToCharArray();

        var redQueue = new PriorityQueue<int>(1);
        var whiteQueue = new PriorityQueue<int>(0);

        var redCount = 0;
        var whiteCount = 0;

        for(var i = 0; i < n; i++)
        {
            if (str[i] == 'R')
            {
                redQueue.Enqueue(i);
                redCount += 1;
            }
            else
            {
                whiteQueue.Enqueue(i);
                whiteCount += 1;
            }
        }

        var count = 0;
        if (redCount == 0 || whiteCount == 0)
        {
            Console.WriteLine(0);
            Console.ReadLine();
            return;
        }


        while (true)
        {
            var redTail = redQueue.Dequeue();
            var whiteHead = whiteQueue.Dequeue();
            if(redTail < whiteHead)
            {
                Console.WriteLine(count);
                break;
            }
            redQueue.Enqueue(whiteHead);
            whiteQueue.Enqueue(redTail);
            count++;
        }



        Console.ReadLine();
    }


}



public class PriorityQueue<T> where T : IComparable
{

    public IComparer<T> Comparer { get; set; }

    public List<T> Heap { get; set; }

    //0=デフォルトで昇順、1で降順
    public int Type { get; set; }

    public PriorityQueue()
    {
        //this.Heap = new T[maxSize];
        this.Heap = new List<T>();
        this.Type = 0;
    }

    public PriorityQueue(int type)
    {
        this.Heap = new List<T>();
        this.Type = type;
    }

    public PriorityQueue(PriorityQueueTypeOrderType type)
    {
        this.Heap = new List<T>();
        this.Type = (int)type;
    }

    public int Compare(T x, T y)
    {
        return this.Type == 0 ? x.CompareTo(y) : y.CompareTo(x);
    }

    public void Enqueue(T n)
    {
        this.Heap.Add(n);

        var child = this.Heap.Count - 1;

        while (child > 0)
        {
            var parent = (child - 1) / 2;

            if (this.Compare(n, this.Heap[parent]) >= 0)
            {
                break;
            }
            var temp = this.Heap[child];
            this.Heap[child] = this.Heap[parent];
            this.Heap[parent] = temp;
            child = parent;

        }
    }

    public T Dequeue()
    {
        var last = this.Heap.Count - 1;
        var result = this.Heap[0];
        this.Heap[0] = this.Heap[last];
        this.Heap.RemoveAt(last);
        last--;
        var parent = 0;
        while (true)
        {
            var child = parent * 2 + 1;
            if (child > last)
            {
                break;
            }
            var rightChild = child + 1;
            if (rightChild <= last && Compare(this.Heap[rightChild], this.Heap[child]) < 0)
            {
                child = rightChild;
            }
            if (Compare(this.Heap[parent], this.Heap[child]) <= 0)
            {
                break;
            }

            var temp = this.Heap[child];
            this.Heap[child] = this.Heap[parent];
            this.Heap[parent] = temp;

            parent = child;
        }
        return result;
    }
}

public enum PriorityQueueTypeOrderType
{
    Ascending = 0,
    Descending = 1,
}


Measured memory_bytes: 24488