/***********************************************
 *                                             *
 *   author: raghav_0901 (Raghav Dalmia)       *
 *   updated on: 04-08-2020,  2:56:33 pm IST   *
 *                                             *
\***********************************************/

#include <bits/stdc++.h>
using namespace std;

#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;

#define int long long int
const int mod = INT_MAX;

// #define cerr  \
//     if (false) \
//     cerr
#define error(args...)                             \
    {                                              \
        string _s = #args;                         \
        replace(_s.begin( ), _s.end( ), ',', ' '); \
        stringstream _ss(_s);                      \
        istream_iterator<string> _it(_ss);         \
        err(_it, args);                            \
    }
void err(istream_iterator<string> it) { cout << '\n'; }
template <typename T, typename... Args>
void err(istream_iterator<string> it, T a, Args... args)
{
    cerr << *it << " = " << a << ", ";
    err(++it, args...);
}

void print( ) { cout << '\n'; }
template <typename T, typename... Args>
void print(T a, Args... args)
{
    cout << a << ' ';
    print(args...);
}

template <typename T>
using ordered_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;

template <typename T>
using min_heap = priority_queue<T, vector<T>, greater<T> >;

class _ncr
{
   private:
    int *fact;
    int *invfact;
    int N, mod;

   public:
    _ncr(int N = (1e6), int mod = INT_MAX)
    {
        this->N = N;
        this->mod = mod;

        fact = new int[N];
        invfact = new int[N];

        fact[0] = fact[1] = 1;
        for (int i = 2; i < N; i++)
        {
            fact[i] = fact[i - 1] * i;
            fact[i] %= mod;
        }
        invfact[N - 1] = modinv(fact[N - 1]);
        for (int i = N - 2; i >= 0; i--)
        {
            invfact[i] = invfact[i + 1] * (i + 1);
            invfact[i] %= mod;
        }
    }
    int get(int n, int r)
    {
        if (r > n)
            return 0;
        int ans = fact[n];
        ans = (ans * invfact[r]) % mod;
        ans = (ans * invfact[n - r]) % mod;
        return ans;
    }

   private:
    int pow(int a, int b)
    {
        int res = 1;
        a %= mod;
        assert(b >= 0);
        for (; b; b >>= 1)
        {
            if (b & 1)
                res = res * a % mod;
            a = a * a % mod;
        }
        return res;
    }
    int modinv(int k) { return pow(k, mod - 2); }
};

#define endl '\n'

#define f(i, begin, end) for (__typeof(end) i = (begin); i != (end); i += 1 - 2 * ((begin) > (end)))
#define ff(i, begin, end, fl) \
    for (__typeof(end) i = (begin); i != (end) && fl; i += 1 - 2 * ((begin) > (end)))

#define mem(arr, val) memset(arr, val, sizeof(arr));
#define ps(x, y) fixed << setprecision(y) << x
#define inf INT_MAX
#define Y                \
    {                    \
        cout << "YES\n"; \
    }
#define N               \
    {                   \
        cout << "NO\n"; \
    }

#define fi first
#define se second
#define mpr(a, b) make_pair(a, b)
typedef pair<int, int> pr;

#define pb emplace_back
#define _in(v) \
    for (auto &x : v) cin >> x;
#define _out(v)                            \
    {                                      \
        for (auto x : v) cout << x << ' '; \
        cout << '\n';                      \
    }
typedef vector<int> vec;
#define all(x) (x).begin( ), (x).end( )
#define allr(x) (x).rbegin( ), (x).rend( )
template <typename T>
T max(vector<T> &v)
{
    return *max_element(all(v));
}
template <typename T>
T min(vector<T> &v)
{
    return *min_element(all(v));
}

#define setbits(x) __builtin_popcountll(x)
#define numbits(x) (64 - __builtin_clzll(x))
#define zerobit(x) __builtin_ctzll(x)
#define log2(x) (63 - __builtin_clzll(x))

#define pi 3.1415926535897932384626433

inline bool isPow2(int x) { return x && (!(x & (x - 1))); }
inline int n_sum(int n) { return (n * (n + 1)) >> 1; }

int pow(int a, int b)
{
    int res = 1;
    a %= mod;
    assert(b >= 0);
    for (; b; b >>= 1)
    {
        if (b & 1)
            res = res * a % mod;
        a = a * a % mod;
    }
    return res;
}

inline int modinv(int k) { return pow(k, mod - 2); }
inline int add(int a, int b) { return ((a % mod) + (b % mod)) % mod; }
inline int sub(int a, int b) { return ((a % mod) - (b % mod) + mod) % mod; }
inline int mul(int a, int b) { return ((a % mod) * (b % mod)) % mod; }

int gcd(int a, int b) { return b ? gcd(b, a % b) : a; }
int lcm(int a, int b) { return a * (b / gcd(a, b)); }

bool isPerfectSquare(int x)
{
    int s = sqrt(x);
    return (s * s == x);
}

bool isFibonacci(int n) { return isPerfectSquare(5 * n * n + 4) || isPerfectSquare(5 * n * n - 4); }

bool isPrime(int n)
{
    if (n <= 1)
        return false;
    if (n <= 3)
        return true;
    if (n % 2 == 0 || n % 3 == 0)
        return false;

    for (int i = 5; i * i <= n; i = i + 6)
        if (n % i == 0 || n % (i + 2) == 0)
            return false;

    return true;
}

vector<int> primeFactors(int n)
{
    vector<int> ans;
    while (n % 2 == 0)
    {
        ans.emplace_back(2);
        n = n >> 1;
    }

    for (int i = 3; i <= sqrt(n); i = i + 2)
    {
        while (n % i == 0)
        {
            ans.emplace_back(i);
            n = n / i;
        }
    }
    if (n > 1)
        ans.emplace_back(n);
    return ans;
}

double sum( ) { return 0.0; }
template <typename T, typename... Args>
T sum(T a, Args... args)
{
    return a + sum(args...);
}

// ncr(max_lim, mod); -----------
_ncr ncr(1e6, INT_MAX);
#define ncr(n, r) ncr.get(n, r);

void _main(void);
signed main( )
{
    ios::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);

    _main( );

    return 0;
}

//--------------------------- Main Function -----------------------

void _main(void)
{
    // code here

    int n;
    cin >> n;
    string s;
    cin >> s;
    vec pre(n + 2, 0), pos(n + 2, 0);
    f(i, 1, n + 1) pre[i] = pre[i - 1] + (s[i - 1] == 'W');
    f(i, n, 0) pos[i] = pos[i + 1] + (s[i - 1] == 'R');
    int ans = n;
    f(i, 0, n + 1)
    {
        int w = pre[i];
        int r = pos[i + 1];
        ans = min(ans, max(w, r));
    }
    print(ans);
    return;
}

Measured memory_bytes: 22408