void main() {
  problem();
}

void problem() {
  auto N = scan!int;
  auto STONES = scan!string.to!(char[]);

  long solve() {
    long curse;
    long stock_w;
    foreach(c; STONES) {
      if (c == 'W') stock_w++;
      if (c == 'R') {
        if (stock_w > 0) {
          curse++;
          stock_w--;
        }
      }
    }

    if (N % 2 == 1) {
      return min(curse, STONES.count('W'), STONES.count('R'));
    }

    curse.deb;
    
    long left = 0;
    long right = N-1;
    long ans;
    while(curse > 0) {
      if (STONES[right] != 'R') {
        right--;
        continue;
      }

      if (STONES[left] != 'W') {
        left++;
        continue;
      }

      STONES.to!string.deb;
      [curse, left, right].deb;

      if (right > 0 && STONES[right-1] == 'W') curse--;
      if (left < N-1 && STONES[left+1] == 'R') curse--;
      STONES[left] = 'R';
      STONES[right] = 'W';
      ans++;
    }
    
    return ans;
  }

  solve().writeln;
}

// ----------------------------------------------

import std.stdio, std.conv, std.array, std.string, std.algorithm, std.container, std.range, core.stdc.stdlib, std.math, std.typecons, std.numeric;
T[][] combinations(T)(T[] s, in int m) {   if (!m) return [[]];   if (s.empty) return [];   return s[1 .. $].combinations(m - 1).map!(x => s[0] ~ x).array ~ s[1 .. $].combinations(m); }
string scan(){ static string[] ss; while(!ss.length) ss = readln.chomp.split; string res = ss[0]; ss.popFront; return res; }
T scan(T)(){ return scan.to!T; }
T[] scan(T)(int n){ return n.iota.map!(i => scan!T()).array; }
void deb(T ...)(T t){ debug writeln(t); }
alias Point = Tuple!(long, "x", long, "y");

// -----------------------------------------------
