import 'dart:async';
import 'dart:io';
import 'dart:convert';

Stream<String> get lineStream =>
    stdin.transform(utf8.decoder).transform(const LineSplitter());

Future<List<String>> readLines() async {
  final lines = <String>[];
  await for (var line in lineStream) {
    lines.add(line);
  }
  return lines;
}

void main() async {
  final lines = await readLines();
  final c = lines[1];
  final w = c.runes.where((e) => e == 'W'.codeUnitAt(0)).length;
  final r = c.runes.where((e) => e == 'R'.codeUnitAt(0)).length;
  if (w == 0 || r == 0) {
    print('0');
    return;
  }
  var count = 0;
  for (var i = 0; i < r; i++) {
    if (c.runes.elementAt(i) == 'W'.codeUnitAt(0)) {
      count++;
    }
  }
  print('$count');
}
