jiahuimbzuai/CoQuIR huggingface dataset:
//  [cpp]
#include<stdio.h>
#include<math.h>
#include<algorithm>
#include<queue>
#include<deque>
#include<stack>
#include<string>
#include<string.h>
#include<vector>
#include<set>
#include<map>
#include<bitset>
#include<stdlib.h>
#include<cassert>
#include<time.h>
#include<bitset>
using namespace std;
const long long mod=1000000007;
const long long inf=mod*mod;
const long long d2=(mod+1)/2;
const double EPS=1e-10;
const double INF=1e+10;
const double PI=acos(-1.0);
const int C_SIZE = 210000;
long long fact[C_SIZE];
long long finv[C_SIZE];
long long inv[C_SIZE];
// long long C(int a,int b){
// 	if(a<b||b<0)return 0;
// 	return fact[a]*finv[b]%mod*finv[a-b]%mod;
// }
void init_C(int n){
	fact[0]=finv[0]=inv[1]=1;
	for(int i=2;i<n;i++){
		inv[i]=(mod-(mod/i)*inv[mod%i]%mod)%mod;
	}
	for(int i=1;i<n;i++){
		fact[i]=fact[i-1]*i%mod;
		finv[i]=finv[i-1]*inv[i]%mod;
	}
}
int ABS(int a){return max(a,-a);}
long long ABS(long long a){return max(a,-a);}
double ABS(double a){return max(a,-a);}
// ここから編集しろ
char in[5];
int main(){
	scanf("%s",in);
	if(in[0]==in[1]||in[1]==in[2]||in[2]==in[3])printf("Bad\n");
	else printf("Good\n");
}
//  [cpp]
#include<stdio.h>
int main(){


int num;
scanf("%d",&num);
int one,two,three,four;
four=num%10;
num/=10;
three=num%10;
num/=10;
two=num%10;
num/=10;
one=num;
  
if(one==two || two==three || three==four){
printf("Bad");}
else{
printf("Good");}



return 0;

}
//  [cpp]
#include <iostream>
 
using namespace std;
 
int main(){
  strint s;
  cin>>s;
  char a='a';
  bool flag = true;
  for(int i=0;i<s.size();i++){
    if(s[i]==a){
      flag=false;
    }
    a=s[i];
  }
  if(flag)cout<<"Good"<<endl;
  else cout<<"Bad"<<endl;
  
}
#include <iostream>

using namespace std;

int main(){
  string s;
  cin>>s;
  char a='a';
  bool flag = true;
  for(int i=0;i<s.size();i++){
    if(s[i]==a){
      flag=false;
    }
    a=s[i];
  }
  if(flag)cout<<"Good"<<endl;
  else cout<<"Bad"<<endl;
  
}
//  [cpp]
#include <iostream>

using namespace std;

int main(){
  strint s;
  cin>>s;
  char a='a';
  bool flag = true;
  for(int i=0;i<s.size();i++){
    if(s[i]==a){
      flag=false;
    }
    a=s[i];
  }
  if(flag)cout<<"Good"<<endl;
  else cout<<"Bad"<<endl;
  
}
//  [cpp]
#include<stdio.h>
#include<iostream>
#include<string>
using namespace std;
int main(){
  string s; scanf("%s",&s);
  for(int i = 0;i < 3;i++){
    if(s[i] == s[i + 1]){
      cout << "Bad" << endl;
      return 0;
    }
  }
  cout << "Good" << endl;
  return 0;
}
//  [c]
//Security
#include<stdio.h>
int main(){
    char s[4];
    scanf("%s",s);
    for(int i=0;i<3;i++){
        if(s[i]==s[i+1]){
            printf("Bad\n");
            return 0;
        }
    }
    printf("Good\n");
    return 0;
}
//  [c]
#include<stdio.h>

int main(){
  int i;
  char s[4];
  scanf("%s",s);
  for(i=1;i<4;i++){
    if(s[i-1]==s[i]){
      printf("Bad\n");
      return 0;
    }
  }
  printf("Good\n");
  return 0;
}
//  [c]
#include <stdio.h>

int main(){
  char s[4];
  for(int i=0;i<4;i++){
    scanf("%c",&s[i]);
  }
  int code = 0;
  for(int j=0;j<3;j++){
    if(s[j+1] == s[j]){
      code = 1;
    }
  }
  if(code == 1){
    printf("Bad\n");
  }else{
    printf("Good\n");
  }
  return 0;
}
//  [c]
#include<stdio.h>

int quotient(int dividend, int divisor);
int add(int a, int b, int divisor);
int lcm(int a, int b);

int main(void){
    int ans;
    int a,b,c,d;
    scanf("%d %d %d %d", &a,&b,&c,&d);
    ans = b-a+1;
    ans -= add(a, b, c);
    ans -= add(a, b, d);
    ans += add(a, b, lcm(c, d));
    printf("%d", ans);
    return 0;
}

int add(int a, int b, int divisor){
    int ans = 0;
    ans += quotient(b, divisor);
    ans -= quotient(a, divisor);
    if (a % divisor == 0){
        ans += 1;
    }
    return ans;
}

// 商を返す関数
int quotient(int dividend, int divisor){
    int remainder, ans;
    remainder = dividend % divisor;
    ans = (dividend - remainder) / divisor;
    return ans;
}

int lcm(int a, int b){
    int r, x, tmp;
    x = a * b;
 
    /* 自然数 a > b を確認・入替 */
    if(a<b){
    tmp = a;
    a = b;
    b = tmp;
    }

    /* ユークリッドの互除法 */
    r = a % b;
    while(r!=0){
    a = b;
    b = r;
    r = a % b;
    }

    /* 最小公倍数を出力 */
    return x/b;

}
//  [c]
#include <stdio.h>
main() {
	char pass[4];
	int a=0;
	scanf("%s",&pass );
	for (int i= 0; i<3; i++) {
		if (pass[i]!=pass[i+1]) {
			continue;
		} else {
			a=1;
		}
	}
	if (a==1) {
		printf("Bad");
	} else  {
		printf("Good");
	}
}
//  [c]
#include <stdio.h>
main() {
	char pass[4];
	int a=0;
	scanf("%s",&pass );

	for (int i= 0; i<3; i++) {
		if (pass[i]!=pass[i+1]) {
			continue;
		} else {
			a=1;
		}
	}
	if (a==1) {
		printf("Bad");
	} else printf("Good");
}
//  [javascript]
"use strict";
    
const main = arg => {
  let Num = arg.split("");
  let ans = "Good";
  for(let i = 0; i < 3; i++){
  	if(Num[i] == Num[i+1]){
       ans = "Bad";
    }
  }
  console.log(ans);
}
main(require('fs').readFileSync('/dev/stdin', 'utf8'));
//  [javascript]
function Main(input) {
    input = input.trim()
  input = input.split("").map(Number);
  if(input[0]==input[1]||input[2]==input[1]||input[2]==input[3]) console.log("Bad");
  else console.log("Good")
}Main(require("fs").readFileSync("/dev/stdin", "utf8"));
//  [javascript]
// inputに入力データ全体が入る
function Main(input) {
  var s;
  s = input.split('\n')[0];
  
  for(var i = 0; i < s.length - 1; i++){
    if(s.charAt(i) === s.charAt(i + 1)){
      console.log('Bad');
      return;
    }
  }
  
  console.log('Good');
  
}
//*この行以降は編集しないでください（標準入出力から一度に読み込み、Mainを呼び出します）
Main(require("fs").readFileSync("/dev/stdin", "utf8"));
//  [javascript]
const Main = input => {
    const array = input.split("");
    const result = new Set(array);
    if(array.length === result.size) {
        console.log("Good");
    } else {
        console.log("Bad");
    }
}
 
Main(require("fs").readFileSync("/dev/stdin", "utf8"));
//  [javascript]
function main(input) {
    const s = input.split('');
    let ans = 'Good';
    for (let i = 0; i < s.length - 1; i++) {
        if (s[i] === s[i + 1]) {
            ans = 'Bad';
        }
    }
    console.log(ans);
}

main(require('fs').readFileSync('/dev/stdin', 'utf8'));
//  [javascript]
function Main(input) {
    input = input.trim()
  input = input.split("").map(Number);
  if(input[0]==input[1]||input[2]==input[1]||input[2]==input[3]) console.log("Good");
  else console.log("Bad")
}Main(require("fs").readFileSync("/dev/stdin", "utf8"));
//  [go]
package main

import (
  "fmt"
)

func main() {
  var s string
  fmt.Scan(&s)
  ans := "Good"
  for i := 0; i < 3; i++ {
    if s[i] == s[i+1] {
      ans = "Bad"
      break
    }
  }
  fmt.Println(ans)
}
//  [go]
package main

import (
	"bufio"
	"fmt"
	"os"
)

const (
	initialBufSize = 1e4
	maxBufSize     = 1e6 + 7
)

var buf []byte = make([]byte, maxBufSize)
var sc = bufio.NewScanner(os.Stdin)

func init() {
	sc.Split(bufio.ScanWords)
	sc.Buffer(buf, maxBufSize)
}

func main() {
	S := nextLine()
	var prev rune
	for _, Si := range S {
		if Si == prev {
			fmt.Println("Bad")
			return
		}
		prev = Si
	}
	fmt.Println("Good")
}

func nextLine() string {
	sc.Scan()
	return sc.Text()
}
//  [go]
package main

import "fmt"

func main() {
	var s string
	fmt.Scan(&s)

	if s[0] == s[1] {
		fmt.Println("Bad")
		return
	}
	if s[1] == s[2] {
		fmt.Println("Bad")
		return
	}
	if s[2] == s[3] {
		fmt.Println("Bad")
		return
	}
	fmt.Println("Good")
}
//  [go]
package main

import "fmt"

func main() {
	var s []byte
	fmt.Scan(&s)


	m :=make(map[string]int, len(s))
	for i := 0;i < len(s);i++ {
		m[string(s[i])]++
		if m[string(s[i])] > 1 {
			fmt.Println("Bad")
			return
		}
	}

	fmt.Println("Good")
}
//  [go]
package main

import "fmt"

func main() {
	var s []byte
	fmt.Scan(&s)


	m :=make(map[string]int, len(s))
	for i := 0;i < len(s);i++ {
		m[string(s[i])]++
		if m[string(s[i])] > 2 {
			fmt.Println("Bad")
			return
		}
	}

	fmt.Println("Good")
}
//  [go]
package main

import (
	"bufio"
	"fmt"
	"os"
	"strconv"
)

var sc = bufio.NewScanner(os.Stdin)

func main() {
	scanInit()

	s := nextStr()

	for i := 1; i < 3; i++ {
		if s[i-1] == s[i] {
			fmt.Println("Bad")
			return
		}
	}

	fmt.Println("Good")

}

// ---- readfunc
func scanInit() {
	const cap = 64 * 1024
	var buf = make([]byte, cap)
	sc.Buffer(buf, cap)
	sc.Split(bufio.ScanWords)
	return
}
func nextInt() int {
	sc.Scan()
	i, e := strconv.Atoi(sc.Text())
	if e != nil {
		panic(e)
	}
	return i
}
func nextStr() string {
	sc.Scan()
	return sc.Text()
}
//  [ruby]
A=gets.chomp.split('').map{|i| i.to_i}
for i in 0..2
	if(A[i] == A[i+1])
		puts "Bad"
		exit(0)
	end
end
puts "Good"
//  [ruby]
s=gets.chomp.chars.map(&:to_i)
if s[0]==s[1]||s[1]==s[2]||s[2]==s[3]
  puts "Bad"
else
  puts "Good"
end
//  [ruby]
input = gets.strip
if((input[0] == input[1]) || (input[1] == input[2]) || (input[2] == input[3]))
  puts "Bad"
else
  puts "Good"
end
//  [ruby]
s=gets.chomp.split("")
ans=s.each_cons(2).count{|a|a[0]==b[1]}
puts ans>=1? "Bad":"Good"
//  [ruby]
s=gets.chomp.split("")
ans=s.cons_each(2).count{|a|a[0]==b[1]}
puts ans>=1? "Bad":"Good"
//  [rust]
use std::io::*;
use std::str::FromStr;

fn read<T: FromStr>() -> T {
    let stdin = stdin();
    let stdin = stdin.lock();
    let token: String = stdin
        .bytes()
        .map(|c| c.expect("failed to read char") as char) 
        .skip_while(|c| c.is_whitespace())
        .take_while(|c| !c.is_whitespace())
        .collect();
    token.parse().ok().expect("failed to parse token")
}

fn main() {
    let s: Vec<char> = read::<String>().chars().collect();
    let mut cnt = 0;
    if s[0] == s[1] { cnt += 1; }
    if s[1] == s[2] { cnt += 1; }
    if s[2] == s[3] { cnt += 1; }
    let ans = if cnt > 0 { "Bad" } else { "Good" };
    println!("{}", ans);
}
//  [rust]
#[allow(unused_macros)]
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        let mut next = || { iter.next().unwrap() };
        input_inner!{next, $($r)*}
    };
    ($($r:tt)*) => {
        let stdin = std::io::stdin();
        let mut bytes = std::io::Read::bytes(std::io::BufReader::new(stdin.lock()));
        let mut next = move || -> String{
            bytes
                .by_ref()
                .map(|r|r.unwrap() as char)
                .skip_while(|c|c.is_whitespace())
                .take_while(|c|!c.is_whitespace())
                .collect()
        };
        input_inner!{next, $($r)*}
    };
}

#[allow(unused_macros)]
macro_rules! input_inner {
    ($next:expr) => {};
    ($next:expr, ) => {};

    ($next:expr, $var:ident : $t:tt $($r:tt)*) => {
        let $var = read_value!($next, $t);
        input_inner!{$next $($r)*}
    };
}

#[allow(unused_macros)]
macro_rules! read_value {
    ($next:expr, ( $($t:tt),* )) => {
        ( $(read_value!($next, $t)),* )
    };

    ($next:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()
    };

    ($next:expr, chars) => {
        read_value!($next, String).chars().collect::<Vec<char>>()
    };

    ($next:expr, usize1) => {
        read_value!($next, usize) - 1
    };

    ($next:expr, $t:ty) => {
        $next().parse::<$t>().expect("Parse error")
    };
}

#[allow(unused_macros)]
macro_rules! debug {
    ($($a:expr),*) => {
        eprintln!(concat!($(stringify!($a), " = {:?}, "),*), $($a),*);
    }
}

fn f(d1: &Vec<i32>, d2: &Vec<i32>) -> bool {
    for i in 0..d1.len() {}

    return true;
}

use std::cmp;
use std::iter::Iterator;

fn main() {
    input! {
        n:chars,
    }

    for i in 1..n.len() {
        if n[i - 1] == n[i] {
            println!("Bad");
            return;
        }
    }
    println!("Good");

}
//  [rust]
fn read_stdin() -> String {
    use std::io::Read;
    let mut input = String::new();
    std::io::stdin().read_to_string(&mut input).unwrap();
    input
}

fn scan<'a, I: Iterator<Item = &'a str>, T: std::str::FromStr>(tokens: &mut I) -> T {
    tokens.next().unwrap().parse().ok().unwrap()
}

fn main() {
    let input = read_stdin();
    let tokens = &mut input.split_whitespace();
    let s: String = scan(tokens);
    let s = s.as_bytes();
    if s[0] == s[1] || s[1] == s[2] || s[2] == s[3] {
        println!("Bad");
    } else {
        println!("Good");
    }
}
//  [rust]
#[allow(unused_imports)]
use std::collections::HashSet;
use std::str::Chars;

fn read<T: std::str::FromStr>() -> T {
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).ok();
    s.trim().parse().ok().unwrap()
}

#[allow(dead_code)]
fn read_vec<T: std::str::FromStr>() -> Vec<T> {
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).ok();
    s.trim()
        .split_whitespace()
        .map(|e| e.parse().ok().unwrap())
        .collect()
}

fn main() {
    let s = read::<String>();
    let s1 = s.chars();
   
    let answer = solve(s1);
    if answer {
        println!("BAD");
    } else {
        println!("GOOD")
    }
}

fn solve(s: Chars) -> bool {
    let mut prev  = 'X';
    for c in s {
        if c == prev {
            return true;
        }
        prev = c
    }
    
    return false;
}
//  [rust]
fn main() {
  proconio::input!{
    mut s: proconio::Chars,
  }
  let n = s.len();
  s.dedup();
  if s.len() < n { println!("Bad") }
  else { println!("Good") }
}
//  [rust]
#[allow(unused_macros)]
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        let mut next = || { iter.next().unwrap() };
        input_inner!{next, $($r)*}
    };
    ($($r:tt)*) => {
        let stdin = std::io::stdin();
        let mut bytes = std::io::Read::bytes(std::io::BufReader::new(stdin.lock()));
        let mut next = move || -> String{
            bytes
                .by_ref()
                .map(|r|r.unwrap() as char)
                .skip_while(|c|c.is_whitespace())
                .take_while(|c|!c.is_whitespace())
                .collect()
        };
        input_inner!{next, $($r)*}
    };
}

#[allow(unused_macros)]
macro_rules! input_inner {
    ($next:expr) => {};
    ($next:expr, ) => {};

    ($next:expr, $var:ident : $t:tt $($r:tt)*) => {
        let $var = read_value!($next, $t);
        input_inner!{$next $($r)*}
    };
}

#[allow(unused_macros)]
macro_rules! read_value {
    ($next:expr, ( $($t:tt),* )) => {
        ( $(read_value!($next, $t)),* )
    };

    ($next:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()
    };

    ($next:expr, chars) => {
        read_value!($next, String).chars().collect::<Vec<char>>()
    };

    ($next:expr, usize1) => {
        read_value!($next, usize) - 1
    };

    ($next:expr, $t:ty) => {
        $next().parse::<$t>().expect("Parse error")
    };
}

#[allow(unused_macros)]
macro_rules! debug {
    ($($a:expr),*) => {
        eprintln!(concat!($(stringify!($a), " = {:?}, "),*), $($a),*);
    }
}

fn f(d1: &Vec<i32>, d2: &Vec<i32>) -> bool {
    for i in 0..d1.len() {}

    return true;
}

use std::cmp;
use std::iter::Iterator;

fn main() {
    input! {
        s:chars,
    }

    let mut ans = false;
    for i in 0..2 {
        if s[i] == s[i+1] {
            ans = true;
            break;
        }
    }

    if ans {
        println!("Bad")
    }else{
        println!("Good")
    }

}
//  [swift]
var s=readLine()!
let start=s.startIndex
let end=s.endIndex
var index0=start
var judge=0
for _ in 0...3{
  var index1=s.index(after: index0)
  if s[index0]==s[index1]{
    judge=1
  }
  index0=s.index(after: index0)
}
if judge==0{
  print("Good")
}else{
  print("Bad")
}
//  [swift]
var str=readLine()!

for num in 0...3{
  let a=str.index(str.startIndex,offsetBy:num)
  let b=str.index(str.startIndex,offsetBy:num+1)

  if str[a]==str[b] {
    print("Bad")
    break;
  }
  else if num==3 {
    print("Good")
  }
}
//  [swift]
var str = readLine()!
for num in 0...3 {
  let a = str.index(str.startIndex, offsetBy: num)
  let b = str.index(str.startIndex, offsetBy: num+1)
  
   if str [a]==str [b] {
    print("Bad")
     break
   }
  else if num==3 {
    print("Good")
  }
}
//  [swift]
var s=readLine()!
let start=s.startIndex
let end=s.endIndex
var index0=start
var judge=0
for _ in 0...3{
  index1=s.index(after: index0)
  if s[index0]==s[index1]{
    judge=1
  }
  index0{after: index0)
}
if judge==0{
  print("Good")
}else{
  print("Bad")
}
//  [swift]
#include<stdio.h>
#include<stdlib.h>
#include<iostream>
#include<string>
#include<algorithm>
#include<vector> 
#include<limits>
#include<numeric>
#include<type_traits>
#include<math.h>
#include<fstream>
#include<set>
using namespace std;
typedef long long ll;

#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define repi(i,a,b) for(int i = (int)(a); i < (int)(b); i++)
#define out(str) cout << str << endl
#define ALL(a) (a).begin(),(a).end()
#define INF (1<<29)

template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }

string S;

int main(){
    cin>>S;
    if(S[0]==S[1]||S[1]==S[2]||S[2]==S[3])out("Bad");
    else out("Good");
    
    
}
//  [typescript]
import * as fs from 'fs';

//in
// 3778
//out
// Bad
const main = (inp: string) => {

    if (inp[0] === inp[1] || inp[1] === inp[2] || inp[2] === inp[3]) {
        console.log('Bad');

    } else {
        console.log('Good');
    }
};
main(fs.readFileSync('/dev/stdin', 'utf8').trim());
//  [typescript]
import * as fs from "fs";

const input = (fs.readFileSync("/dev/stdin", "utf8") as string).split("\n");
//const n = +input[0];
//const a = [];
//for(let i=0;i<n;i++){
//	a.push(input[i+1].split(" ").map((x:string):number=>+x));
//}

//const [n, m] = input[0].split(" ").map((x: string): number => +x);
//const a = input[1].split(" ").map((x: string): number => +x);

function compareFunc(a, b){
    return a-b;
}

const s: string[] = input[0].split('');

if(s[0] === s[1] || s[1] === s[2] || s[2] === s[3]){
    console.log('Bad');
}else{
    console.log('Good');
}
//  [typescript]
const input=require('fs').readFileSync('/dev/stdin', 'utf8').split(/[\s]/);const nin=()=>{const r = input[0];input.shift();return Number(r)};const nrin=(n)=>{const a:number[]=[];rep(n,()=>a.push(nin()));return a};const sin=()=>{const r = input[0];input.shift();return String(r)};const out=(...a)=>{console.log(...a)};const floor=(a)=>{return Math.floor(a)};const abs=(a)=>{return Math.abs(a)};const min=(...a)=>{return Math.min(...a)};const max=(...a)=>{return Math.max(...a)};const rep=(n, callback)=>{for(let i = 0;i < n; i++){callback()}};const strrep=(s, i, v)=>{return s.slice(0, i)+v+s.slice(i+1);};const permutation=({result=[],pre=[],post,n=post.length})=>{if(n>0){post.forEach((_,i)=>{const rest=[...post];const elem=rest.splice(i, 1);permutation({result, pre: [...pre,...elem],post:rest,n:n-1})})}else{result.push(pre)}return result};const sw=(s,a:any[],op:'=='|'>='|'>'|'<='|'<'='==')=>{for(let i=0;i<a.length;i+=2){if(op==='=='){if(s==a[i])return a[i+1]}else if(op==='>='){if(s>=a[i])return a[i+1]}else if(op==='<='){if(s<=a[i])return a[i+1]}else if(op==='>'){if(s>a[i])return a[i+1]}else if(op==='<'){if(s<a[i])return a[i+1]}}return a[a.length-1];};const or=(a,...b)=>{for(let i=0;i<b.length;i++)if(a==b[i])return true;return false};const maxindex=(...a)=>{return a.indexOf(Math.max.apply(null,a))};const asc=(ar:number[])=>{return ar.sort((a,b)=>{return a-b})};const desc=(ar:number[])=>{return ar.sort((a,b)=>{return b-a})};const ceil=a=>{return Math.ceil(a)};const srin=s=>{const a:string[]=[];rep(s,()=>a.push(sin()));return a};let ssinteger=-1;const ssin=()=>{ssinteger++;return input[0][ssinteger]};
const main = ()=>{
  let a=[ssin(),ssin(),ssin(),ssin()]
  out(a[0]==a[1]||a[1]==a[2]||a[2]==a[3]?'Bad':'Good')
}
main()
//  [typescript]
import * as fs from 'fs';

//in
// 3778
//out
// Bad
const main = (inp: string) => {

    if (inp[0] === inp[1] || inp[1] === inp[2] || inp[2] === inp[3]) {
        console.log('Bad');

    } else {
        console.log('Yes');
    }

};


main(fs.readFileSync('/dev/stdin', 'utf8').trim());
//  [typescript]
import * as fs from "fs";

const input = (fs.readFileSync("/dev/stdin", "utf8") as string).split("\n");
//const n = +input[0];
//const a = [];
//for(let i=0;i<n;i++){
//	a.push(input[i+1].split(" ").map((x:string):number=>+x));
//}

//const [n, m] = input[0].split(" ").map((x: string): number => +x);
//const a = input[1].split(" ").map((x: string): number => +x);

function compareFunc(a, b){
    return a-b;
}

const s: string[] = input[0].split('').sort();

if(s[0] === s[1] || s[1] === s[2] || s[2] === s[3]){
    console.log('Bad');
}else{
    console.log('Good');
}
//  [python]
n = int(input())
k = input()

a = k.count("R")
b = k[:a].count("W")
print(b)
//  [python]
n=int(input())
s=input()

a = s.count('R')
b = s[:a].count('R')

print(a-b)
//  [python]
# -*- coding: utf-8 -*-
"""
Created on Sun Aug  2 21:49:26 2020

@author: naoki
"""

N = int(input()) # N = the number of stones 
stones = input() # input the colors of stones 
count1 = stones.count("R") #the number of red stones 
stones2 = stones[count1:]
count2 = stones2.count("R")
print(count2)
//  [python]
if __name__ == '__main__':
    N = int(input())
    C = list(input())
    cnt = 0
    red_cnt = 0
    for c in C:
        if c == 'R':
            red_cnt += 1

    for i in range(red_cnt+1):
        if C[i] == 'W':
            for j in range(red_cnt, N):
                if C[j] == 'R':
                    C[i] = 'R'
                    C[j] = 'W'
                    cnt += 1
                    red_cnt = j+1
    print(cnt)
//  [python]
if __name__ == '__main__':
    N = int(input())
    C = list(input())
    cnt = 0
    red_cnt = 0
    for c in B:
        if c == 'R':
            red_cnt += 1

    for i in range(red_cnt+1):
        if C[i] == 'W':
            for j in range(red_cnt, N):
                if C[j] == 'R':
                    C[i] = 'R'
                    C[j] = 'W'
                    cnt += 1
                    red_cnt = j+1
    print(cnt)
//  [python]
if __name__ == '__main__':
    N = int(input())
    C = list(input())
    cnt = 0
    red_cnt = 0
    B = sorted(C)
    for c in B:
        if c == 'R':
            red_cnt += 1
        else:
            break
    for i in range(red_cnt+1):
        if C[i] == 'W':
            for j in range(red_cnt, N):
                if C[j] == 'R':
                    C[i] = 'R'
                    C[j] = 'W'
                    cnt += 1
                    red_cnt = j+1
    print(cnt)
//  [cpp]
#include<cstdio>
char s[200005];
int main() {
	int n,tot=0,ans=0;
	scanf("%d%s",&n,s);
	for(register int i=0;i<n;++i) {
		if(s[i]=='R') ++tot;
	} 
	ans=tot;
	for(register int i=0;i<tot;++i) {
		if(s[i]=='R') --ans;
	}
	printf("%d\n",ans);
	return 0;
}
//  [cpp]
#include <cstdio>
#include <cstring>

char s[200005];
int main()
{
	int n,sum=0;
	scanf("%d",&n);
	scanf("%s",s);
	int l=0,r=n-1;
	for (int i=0;i<n;i++){
		if (s[i]=='W') {
			l=i;
			int f=1;
			for (int j=r;j>i;j--){
				if (s[j]=='R') {
					s[i]='R';
					s[j]='W';
					sum++;
					f=0;
					r=j-1;
					break;
				}
			}
			if (f) break;
		}
	}
	if (l) {
		for (int i=l;i<r;i++) {
			if (s[i]=='R') sum++;
		}
	}
	printf("%d",sum);
	return 0;
}
//  [cpp]
#include <bits/stdc++.h>
using namespace std;

int main() {
int n;
string s;
cin>>n>>s;
int w=0;
int ans=0;
for (int i = 0; i < n; i++)
{
    
    
    if(s[i]=='W'){
        w++;
    }
}
 for (int i = 0; i < n; i++)
{
    
    if(i<w){
    if(s[i]=='W'){
        ans++;
    }
    }
}
cout<<ans<<endl;

}
//  [cpp]
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<ll, ll> l_l;
typedef pair<int, int> i_i;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))
// #define debug(a) cout << "["; rep(i,a.size()) cout << a[i] << ", "; cout<<"]"<< endl;

const ll mod = 1000000007;

int main() {
    int n;
    string s; 
    cin >> n >> s;
    int left = 0, right = n - 1;
    int ans = 0;
    while(left <= right){
        if(s[left] == 'W'){
            while(right >= 0){
                if(s[right] != 'R') {
                    right--;
                } else {
                    break;
                }
            }
            if(right < 0) break;
            ans++;
            right--;
        }
        left++;
    }
    cout << ans << endl;
    return 0;
}
//  [cpp]
#include<bits/stdc++.h>
using namespace std;

int main(){
  int n,r=0;
  cin>>n;
  string s;
  cin>>s;
  for(int i=0;i<n;i++){
    if(s[i]=='R') r++;
    }
  int c=0;
  for(int i=0;i<r;i++)
    if(s[i]=='W') c++;
    }
cout<<c;
  
  return 0;
  }
//  [c]
#include <stdio.h>
#include <unistd.h>

int main()
{
	int i;
	int n;
	int w;
	int r;

	r = 0;
	w = 0;
	scanf("%d", &n);
	char str[n + 1];
	scanf("%s", str);
	i = 0;
	while (str[i])
	{
		if (str[i] == 'R')
			r++;
		i++;
		n--;
	}
	i = 0;
	while (r)
	{
		if (str[i] == 'W')
			w++;
		i++;
		r--;
	}
	printf("%d", w);
	return (0);
}
//  [c]
#include<stdio.h>
#include<string.h>	
#include<math.h>
char s[200005];
void swap(char *a,char *b){
	char c=*a;
	*a=*b;
	*b=c;
}
int main(){
	int n,ans=0;
	scanf("%d",&n);
	scanf("%s",s);
	int left=0,right=n-1;
	while(left<right){
		if(s[left]=='W'&&s[right]=='R'){
			swap(&s[left],&s[right]);
			left++;
			right--;	
			ans++;
		}
		else if(s[left]!='W')left++;
		else if(s[right]!='R')right--;
	} 
	printf("%d",ans);
	return 0;
}
//  [c]
#include <stdio.h>
#include <stdlib.h>

int main(int argc, char const *argv[])
{
    unsigned long N;
    scanf("%lu", &N);

    char *c;
    c = malloc(sizeof(char) * (N + 1));

    unsigned cr = 0, cw = 0;
    scanf("%s", c);

    for (size_t i = 0; i < N; i++)
    {
        if (c[i] == 'R')
        {
            cr++;
        }
        else
        {
            cw++;
        }
    }

    unsigned count = 0;
    for (size_t i = 0; i < cr; i++)
    {
        if (c[i] == 'W')
        {
            count++;
        }
    }

    printf("%u\n", count);

    return 0;
}
//  [c]
#define _CRT_SECURE_NO_WARNINGS
#include <stdio.h>
int main()
{
	int i, W = 0, R = 0, N, m, ans = 0, flag = 0;
	char WR[200000];
	scanf("%d", &N);
	WR[N + 1] = '\0';
	for (i = 0; i <= N; i++) {
		scanf("%c", &WR[i]);
	}
	for (i = 0; i <= N; i++) {
		if (WR[i] == 'R') {
			R++;
		}
		if (WR[i] == 'W') {
			W++;
		}
	}
	if (W < R && W != 0) {
		printf("%d", W);
	}
	else if (W == 0) {
		printf("%d", R);
	}
	if (R < W && R != 0) {
		printf("%d", R);
	}
	else if (R == 0) {
		printf("%d", W);
	}
	if (W == R) {
		for (i = 0; i <= R; i++) {
			if (WR[i] == 'W') {
				ans++;
				flag = 1;
			}
		}
	}
	if (flag == 1) {
		printf("%d", ans);
	}
}
//  [c]
#include <stdio.h>

int abs(int num){
        if(num<0)return num*-1;
        else return num;
}

int min(int a,int b){
        if(a<b)return a;
        else return b;
}

int main(){
        int N,ans;
        scanf("%d\n",&N);
        ans=N;
        char c[N];
        int Ws[N+1],Rs[N+1];
        for(int i=0;i<N;i++)scanf("%c",&c[i]);

        Ws[0]=0;
        Rs[0]=0;
        for(int i=1;i<=N;i++){
                Ws[i]=Ws[i-1];
                Rs[i]=Rs[i-1];
                if(c[i-1]=='W')Ws[i]++;
                else (Rs[i]++);
        }
        for(int i=1;i<=N;i++){
                int W=Ws[i],R=N-Ws[N]-Rs[i];
                int swapNum=min(W,R);
                int changeNum=abs(W-R);
                ans=min(ans,swapNum+changeNum);
        }

        printf("%d\n",ans);
        return 0;
}
//  [c]
#include <stdio.h>

int abs(int num){
        if(num<0)return num*-1;
        else return num;
}

int min(int a,int b){
        if(a<b)return a;
        else return b;
}

int countof(char c[],int from,int to,int target){
        int ans=0;
        for(int i=from;i<to;i++){
                if(c[i]==target)ans++;
        }
        return ans;
}

int main(){
        int N,ans;
        scanf("%d\n",&N);
        ans=N;
        char c[N];
        for(int i=0;i<N;i++)scanf("%c",&c[i]);

        for(int sep=0;sep<N;sep++){
                int W,R,swapNum,changeNum;
                W=countof(c,0,sep,'W');
                R=countof(c,sep+1,N,'R');
                swapNum=min(W,R);
                changeNum=abs(W-R);
                ans=min(ans,swapNum+changeNum);
        }

        printf("%d\n",ans);
        return 0;
}
//  [javascript]
console.log((args=>{
  const [n,c] = args.trim().split`\n`;
  const N = n|0;
  let j = N, count = 0;
  for ( let i = 0; i < j; i++ ) {
    if ( c[i] === 'R' ) continue;
    for (;j > i;) {
      if ( c[j--] === 'R' ) {
        count++;
        break;
      }
    }
  }
  return count;
})(require('fs').readFileSync('/dev/stdin', 'utf8')));
//  [javascript]
function Main(input) {
  var array = input.split("\n");
  var N = array[0] - 0;
  var stone = array[1];
  var count = 0;
  var j = N;
  for (var i = 0; i < N; i++) {
    if (stone[i] === 'W') {
      for (; j > i;) {
        j--;
        if (stone[j] === 'R') {
          count++;
          break;
        }
      }
    }
  }
  console.log(count);
}
Main(require("fs").readFileSync("/dev/stdin", "utf8"));
//  [javascript]
"use strict"
const create = () => {
    const input = require("fs").readFileSync("/dev/stdin", "utf8").trim().split("\n");
    const res = {
        "list": input, "index": 0, "max": input.length,
        "hasNext": function() {return this.index < this.max},
        "next": function() { if (!this.hasNext()) {throw "ArrayIndexOutOfBoundsException";}else{return this.list[this.index++];}}
    };
    return res;
}
const o = create();
const next = () => o.next()
const nextInt = () => parseInt(o.next())
const nextStrArray = () => o.next().split(" ")
const nextIntArray = () => o.next().split(" ").map(el => parseInt(el))
const nextCharArray = () => o.next().split("")
const hasNext = () => o.hasNext()
const myout = (...x) => console.log(...x)
const Main = () => {
    let n = nextInt()
    let c = next().split("")
    let l = 0
    let r = c.length-1
    let cnt = 0
    while(l <= r){
        if(c[l] == "W" && c[r] == "R"){
            c[l] == "R"
            c[r] == "W"
            cnt++
            l++
            r--
            continue
        }
        if(c[l] == 'R'){
            l++
        }
        if(c[r] == 'W'){
            r--
        }
    }
    console.log(cnt)
}
Main()
//  [javascript]
(async () => {
    let input = '';
    for await (const chunk of process.stdin) input += chunk;
    const values = input.split(/\s/);
    const n = +values.shift();
    let c = values[0].split('').slice(0, n);

    let count = 0;
    while(true){
        const lastRed = c.lastIndexOf('R');
        const firstWhite = c.indexOf('W');
        if(lastRed < firstWhite)break;
        if(lastRed == -1)break;
        if(firstWhite == -1)break;
        c[lastRed] = 'W';
        c[firstWhite] = 'R';
        count++;
    }
    console.log(count);
})()
//  [javascript]
function Main(input) {
	input = input.split("\n")  
  	let output=0
    
   // console.log(input[1],"x")
  
    for(let i=1;;i++){
      if(/WR/.test(input[1])){
		input[1] = input[1].replace(/R(W*)$/,"W$1") //一番右のR
        input[1] = input[1].replace(/^(R*)W/,"$1R") //一番左のW
        
        output++
        
    //    console.log(input[1],i)
      }else{
      	break;
      }
	}

    console.log(output)
}
Main(require("fs").readFileSync("/dev/stdin", "utf8"));
//  [javascript]
function MainD(input){
    const arr = input.split('\n');
    const N = arr[0];
    const Ci = arr[1].split('');
    let answer = 0;

    // Wの数を数える
    let Wnum = 0;
    for(let i=0; i<Ci.length; i++){
        if(Ci[i] === 'W'){
            Wnum++;
        }
    }
    if(Wnum===0) return console.log(0); // Wが現れなかったら0を出力

    // Rの数以降のRの数を数える
    for(let i=Ci.length-Wnum-1; i<Ci.length; i++){
        if(Ci[i] === 'R'){
            answer++;
        }
    }
    console.log(answer);
}
MainD(require("fs").readFileSync("/dev/stdin", "utf8"));
//  [go]
package main

import (
	"bufio"
	"fmt"
	"math"
	"os"
	"sort"
	"strconv"
)

var sc = bufio.NewScanner(os.Stdin)
var out = bufio.NewWriter(os.Stdout)

func main() {
	/*/TODO:!!!!!!!テスト用!!!!!!!!!
	sc = bufio.NewScanner(strings.NewReader(`
										`))
	//TODO:!!!!!!!テスト用!!!!!!!!!*/

	buf := make([]byte, 1024*1024)
	sc.Buffer(buf, bufio.MaxScanTokenSize)
	sc.Split(bufio.ScanWords)
	defer out.Flush() // !!!!caution!!!! you must use Fprint(out, ) not Print()
	/* --- code --- */
	//fmt.Fprintln(out, "[DEBUG]", time.Now())

	n := nextInt()
	c := next()

	rc := 0

	for i := 0; i < n; i++ {
		if c[i] == 'R' {
			rc++
		}
	}

	wc := 0
	for i := 0; i < rc; i++ {
		if c[i] == 'W' {
			wc++
		}
	}

	ans := wc

	//fmt.Fprintln(out, "[DEBUG]", a)
	fmt.Fprintln(out, ans)

}

// 挿入ソート配列
type slist struct {
	l []int
}

func makeSlist() slist {
	return slist{[]int{}}
}

func (s *slist) add(a int) {
	pos := sort.Search(len(s.l), func(i int) bool { return s.l[i] >= a })
	if pos < len(s.l) {
		s.l = append(s.l[:pos+1], s.l[pos:]...)
		s.l[pos] = a
	} else {
		s.l = append(s.l, a)
	}
}
func (s slist) contains(a int) bool {
	pos := sort.Search(len(s.l), func(i int) bool { return s.l[i] >= a })
	return pos < len(s.l) && s.l[pos] == a
}

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

// -*-*-*-*-*-*-*-*-
// * I/O utilities *
// -*-*-*-*-*-*-*-*-

func next() string {
	sc.Scan()
	return sc.Text()
}

func nextInt() int {
	a, _ := strconv.Atoi(next())
	return a
}

func nextFloat64() float64 {
	a, _ := strconv.ParseFloat(next(), 64)
	return a
}

func nextInts(n int) []int {
	ret := make([]int, n)
	for i := 0; i < n; i++ {
		ret[i] = nextInt()
	}
	return ret
}
func nextFloats(n int) []float64 {
	ret := make([]float64, n)
	for i := 0; i < n; i++ {
		ret[i] = nextFloat64()
	}
	return ret
}
func nextStrings(n int) []string {
	ret := make([]string, n)
	for i := 0; i < n; i++ {
		ret[i] = next()
	}
	return ret
}

func chars(s string) []string {
	ret := make([]string, len([]rune(s)))
	for i, v := range []rune(s) {
		ret[i] = string(v)
	}
	return ret
}

func printArray(a []int) {
	for i := 0; i < len(a); i++ {
		if i >= 1 {
			fmt.Fprint(out, " ")
		}
		fmt.Fprint(out, a[i])
	}
	fmt.Fprintln(out)
}

func absInt(x int) int {
	return int(math.Abs(float64(x)))
}
func minInt(x, y int) int {
	if x < y {
		return x
	}
	return y
}
func maxInt(x, y int) int {
	if x > y {
		return x
	}
	return y
}
func log10(x int) float64 {
	return math.Log10(float64(x))
}
//  [go]
package main

import (
	"fmt"
	"math"
)

func main() {
	// Code for D - Alter Altar
	var N int
	fmt.Scanf("%d", &N)

	var S string
	fmt.Scanf("%s", &S)

	var flag1 int = 0
	var flag2 int = 0
	var count1, count2, count3 int
	for i := 0; i < N; i++ {
		if flag1 == 0 && S[i] == 'W' {
			count1++
		} else if flag1 == 0 && S[i] == 'R' {
			flag1 = 1
		} else if flag1 == 1 && S[i] == 'W' {
			flag2 = 1
		} else if flag2 == 1 && S[i] == 'R' {
			count2++
		}

		if S[i] == 'R' {
			count3++
		}
	}
	if count2 >= count1 {
		fmt.Println(int(math.Min(float64(count2), float64(count3))))
	} else {
		fmt.Println(int(math.Min(float64(count1), float64(count3))))
	}
}
//  [go]
package main

import (
	"fmt"
	"math"
)

func main() {
	// Code for D - Alter Altar
	var N int
	fmt.Scanf("%d", &N)

	var S string
	fmt.Scanf("%s", &S)

	var flag1 int = 0
	var flag2 int = 0
	var count1, count2, count3 int
	for i := 0; i < N; i++ {
		if flag1 == 0 && S[i] == 'W' {
			count1++
		} else if flag1 == 0 && S[i] == 'R' {
			flag1 = 1
		} else if flag1 == 1 && S[i] == 'W' {
			flag2 = 1
		} else if flag1 == 1 && flag2 == 1 && S[i] == 'R' {
			count2++
		}

		if S[i] == 'R' {
			count3++
		}
	}
	if count2 >= count1 {
		fmt.Println(int(math.Min(float64(count2), float64(count3))))
	} else {
		fmt.Println(int(math.Min(float64(count1-count2), float64(count3))))
	}
}
//  [go]
package main

import (
	"fmt"
	"math"
)

func main() {
	// Code for D - Alter Altar
	var N int
	fmt.Scanf("%d", &N)

	var S string
	fmt.Scanf("%s", &S)

	var flag1 int = 0
	var flag2 int = 0
	var count1, count2, count3 int
	for i := 0; i < N; i++ {
		if flag1 == 0 && S[i] == 'W' {
			count1++
		} else if flag1 == 0 && S[i] == 'R' {
			flag1 = 1
		}

		if flag1 == 1 && S[i] == 'W' {
			flag2 = 1
		} else if flag1 == 1 && flag2 == 1 && S[i] == 'R' {
			count2++
		}

		if S[i] == 'R' {
			count3++
		}
	}
	if count2 >= count1 {
		fmt.Println(int(math.Min(float64(count2), float64(count3))))
	} else {
		fmt.Println(int(math.Min(float64(count1-count2), float64(count3))))
	}
}
//  [ruby]
n = gets.to_i
c = gets.chomp
r = c.count(?R)
w = n - r
p [c[0,r].count(?W), c[-w..-1].count(?R)].min
//  [ruby]
n = gets.to_i
c = gets.chop
nr = c.count('R')
puts c[0, nr].count('W')
//  [ruby]
_,t=*$<
p t[0,t.count(?R)].count ?W
//  [ruby]
n=gets.to_i
s=gets.chomp

r=s.count("R")
w=s.count("W")
ans=[r,w].min
w=0

(n-2).times do |i|
    if s[i]=="W"
        w+=1
    else
        r-=1
    end
end

puts ans
//  [ruby]
n=gets.to_i
s=gets.chomp

r=s.count("R")
w=s.count("W")
ans=[r,w].min

(n-2).times do |i|
    w=s[0..i].count("W")
    r=s[i+1..n-1].count("R")
    ans=[ans,[w,r].max].min
end

puts ans
//  [ruby]
n = gets.chomp.to_i
cs = gets.chomp.split('')

r_cnt = cs.count { |c| c == 'R' }
w_cnt = cs[..r_cnt].count { |c| c == 'W' }

puts w_cnt
//  [rust]
#[allow(unused_imports)]
use itertools::Itertools;
#[allow(unused_imports)]
use num::Integer;
#[allow(unused_imports)]
use proconio::derive_readable;
use proconio::fastout;
use proconio::input;
#[allow(unused_imports)]
use proconio::marker::*;
#[allow(unused_imports)]
use std::cmp;
#[allow(unused_imports)]
use std::collections::*;

#[fastout]
fn main() {
    input! {
        n: usize,
        s: Chars,
    }
    let mut ans = n;
    let mut w2r = 0;
    let mut r2w = s.iter().filter(|&&c| c == 'R').count();
    for i in 0..=n {
        ans = cmp::min(ans, cmp::max(w2r, r2w));
        if i == n {
            break;
        }
        if s[i] == 'W' {
            w2r += 1;
        } else {
            r2w -= 1;
        }
    }

    println!("{}", ans);
}
//  [rust]
use proconio::input;
use proconio::marker::Chars;

fn main() {
    input!{
      _n: usize,
      mut c: Chars,
    };
    let red = c.iter().filter(|&s| *s == 'R').count();
    let mut result = 0;
    for i in 0..red {
        if c[i as usize] == 'W' {
            result += 1;
        }
    }
    println!("{}", result);
}
//  [rust]
use proconio::input;
use std::cmp::min;

fn main() {
    input! {
        _n: usize,
        cs: String
    }

    let mut cs: Vec<usize> = cs.chars().map(|c| if c == 'R' { 1 } else { 0 }).collect();

    if cs.iter().all(|&c| c == cs[0]) {
        print!("0");
        return;
    }

    let mut total = 0;

    let mut w_idx = 0;
    loop {
        if cs[w_idx] == 0 {
            cs[w_idx] = 1;
            w_idx += 1;
        } else {
            break;
        }
    }
    total += w_idx;

    let mut w_found = false;
    for i in w_idx..cs.len() {
        if w_idx == 0 {
            break;
        }
        if w_found && cs[i] == 1 {
            cs[i] = 0;
            w_idx -= 1;
        }
        if !w_found && cs[i] == 0 {
            w_found = true;
        }
    }
    if w_found {
        for i in 0..cs.len() {
            if cs[i] == 0 {
                w_idx = i;
                break;
            }
        }

        let r_sum: usize = cs[w_idx..].iter().sum();
        total += min(r_sum, cs.len() - 1 - r_sum);
    }

    println!("{}", total);
}
//  [rust]
use proconio::input;
use std::cmp::min;

fn main() {
    input! {
        _n: usize,
        cs: String
    }

    let mut cs: Vec<usize> = cs.chars().map(|c| if c == 'R' { 1 } else { 0 }).collect();

    if cs.iter().all(|&c| c == cs[0]) {
        print!("0");
        return;
    }

    let mut total = 0;

    let mut w_idx = 0;
    loop {
        if cs[w_idx] == 0 {
            cs[w_idx] = 1;
            w_idx += 1;
        } else {
            break;
        }
    }
    total += w_idx;

    let mut r_idx = 0;
    let mut w_found = false;
    for i in w_idx..cs.len() {
        if w_idx == 0 {
            break;
        }
        if w_found && cs[i] == 1 {
            cs[i] = 0;
            w_idx -= 1;
        }
        if !w_found && cs[i] == 0 {
            r_idx = i - 1;
            w_found = true;
        }
    }
    let r_sum: usize = cs[r_idx + 1..].iter().sum();
    total += min(r_sum, cs.len() - 1 - r_sum);
    println!("{}", total);
}
//  [rust]
use proconio::input;
use std::cmp::min;

fn main() {
    input! {
        _n: usize,
        cs: String
    }

    let mut cs: Vec<usize> = cs.chars().map(|c| if c == 'R' { 1 } else { 0 }).collect();

    let mut n1 = 0;
    while let Some(&e) = cs.first() {
        if e == 0 {
            cs.remove(0);
            loop {
                if cs.pop() != Some(0) {
                    break;
                }
            }
            n1 += 1;
        } else {
            break;
        }
    }

    let mut n2 = 0;
    if cs.len() > 0 {
        let r_sum: usize = cs[1..].iter().sum();
        n2 += min(r_sum, cs.len() - 1 - r_sum);
    }
    println!("{}", n1 + n2);
}
//  [swift]
let n = Int(readLine()!)!
var s = Array(readLine()!)

var red = s.filter { $0 == "R" }.count
var white = 0
var ans = Int.max

for i in -1..<n {
  if i == -1 {
    ans = min(ans, red)
    continue
  }
  red -= s[i] == "R" ? 1 : 0
  white += s[i] == "W" ? 1 : 0
  ans = min(ans, max(red, white))
}
print(ans)
//  [swift]
func main(input1: String = readLine()!, input2: String = readLine()!) {
    let stones = Array(input2)
    let numberOfR = stones.filter { $0 == "R" }.count
    if numberOfR == 0 {
        return print(0)
    }
    let numberOfMovingW = stones[..<numberOfR].filter { $0 == "W" }.count
    print(numberOfMovingW)
}

main()
//  [swift]
import Foundation

let N = Int(readLine()!)!
let array = Array(readLine()!)
var wArray = Array(repeating: 0, count: N + 1)
var rc = 0
var wc = 0
for i in 0..<N{
  if(array[i] == "W"){
    wc += 1
  }else{
    rc += 1
  }
  wArray[i + 1] = wc
}
print(wArray[rc])
//  [swift]
// 🐋💭
import Foundation

func readInts() -> [Int] {
    return readLine()!.split(separator: " ").map { Int($0)! }
}

func readInt() -> Int {
    return Int(readLine()!)!
}

func readDoubles () -> [Double] {
    return readLine()!.split(separator: " ").map { Double($0)! }
}

func readDouble() -> Double{
    return Double(readLine()!)!
}
///最大公約数を返す
func gcd(_ m:Int, _ n:Int) -> Int {
    if n == 0 {return m}
    return gcd(n, m % n)
}
///最小公倍数を返す
func lcm(_ m:Int, _ n:Int) -> Int {
    return m * n / gcd(m, n)
}

///素数判定(試し割り)
func isPrime(_ x:Int) -> Bool {
    if x <= 1 || x % 2 == 0 { return false }
    if x == 2 { return true }
    for i in stride(from: 3, to: Int(ceil(sqrt(Double(x)))), by: 2){
        if x % i == 0 {
            return false
        }
    }
    return true
}

//https://program-life.com/669
///実行速度の計測
func exectionTime(action: () -> Void) {
    let startDate = Date()
    action()
    let endDate = Date()
    print(endDate.timeIntervalSince(startDate))
}

// https://melheaven.hatenadiary.jp/entry/atcoder144
///約数の配列を返す
func makeDivisors(_ n:Int) -> [Int] {
    var divisors = [Int]()
    for i in 1..<Int(pow(Double(n), 0.5)) + 1 {
        if n % i == 0{
            divisors.append(i + n / i)
        }
    }
    
    return divisors
}

//https://riptutorial.com/ja/swift/example/14738/インデックスを知らずに配列から要素を削除する
extension Array where Element: Equatable {
    
    mutating func remove(_ element: Element) {
        _ = firstIndex(of: element).flatMap {
            self.remove(at: $0)
        }
    }
}

func binarySearch(rifgt:Int, key:Int, ary:[String]) -> Int{
    var left = 0
    var right = rifgt
    
    while abs(right - left) > 1 {
        let mid = left + (right - left) / 2
        
        if Int(ary[mid])! < key {
            left = mid
            
        } else {
            right = mid
        }
    }
    return left
}

func arrangement (prev:String, ary:[String], returnVal:[String]) -> [String] {
    var returnVal = returnVal
    if ary.count == 0 {
        returnVal.append(prev)
        return returnVal
    }
    
    for s in ary {
        let wprev = prev + s
        var wary = ary
        wary.remove(s)
        returnVal = arrangement(prev: wprev, ary: wary, returnVal: returnVal)
    }
    return returnVal
}

func main() {
    let n = readInt()
    let aryC = readLine()!.map { String($0) }
    //＿＿＿＿＿＿＿＿＿＿＿＿＿＿＿＿＿＿＿＿＿＿＿＿＿＿＿＿＿＿＿＿ここまで入力
    let rStones = aryC.filter { $0 == "R"}.count
    let ans = aryC[..<rStones].filter { $0 == "W"}.count
    
    print(ans)
}
//  [swift]
// 🐋💭
import Foundation

func readInts() -> [Int] {
    return readLine()!.split(separator: " ").map { Int($0)! }
}

func readInt() -> Int {
    return Int(readLine()!)!
}

func readDoubles () -> [Double] {
    return readLine()!.split(separator: " ").map { Double($0)! }
}

func readDouble() -> Double{
    return Double(readLine()!)!
}
///最大公約数を返す
func gcd(_ m:Int, _ n:Int) -> Int {
    if n == 0 {return m}
    return gcd(n, m % n)
}
///最小公倍数を返す
func lcm(_ m:Int, _ n:Int) -> Int {
    return m * n / gcd(m, n)
}

///素数判定(試し割り)
func isPrime(_ x:Int) -> Bool {
    if x <= 1 || x % 2 == 0 { return false }
    if x == 2 { return true }
    for i in stride(from: 3, to: Int(ceil(sqrt(Double(x)))), by: 2){
        if x % i == 0 {
            return false
        }
    }
    return true
}

//https://program-life.com/669
///実行速度の計測
func exectionTime(action: () -> Void) {
    let startDate = Date()
    action()
    let endDate = Date()
    print(endDate.timeIntervalSince(startDate))
}

// https://melheaven.hatenadiary.jp/entry/atcoder144
///約数の配列を返す
func makeDivisors(_ n:Int) -> [Int] {
    var divisors = [Int]()
    for i in 1..<Int(pow(Double(n), 0.5)) + 1 {
        if n % i == 0{
            divisors.append(i + n / i)
        }
    }
    
    return divisors
}

//https://riptutorial.com/ja/swift/example/14738/インデックスを知らずに配列から要素を削除する
extension Array where Element: Equatable {
    
    mutating func remove(_ element: Element) {
        _ = firstIndex(of: element).flatMap {
            self.remove(at: $0)
        }
    }
}

func binarySearch(rifgt:Int, key:Int, ary:[String]) -> Int{
    var left = 0
    var right = rifgt
    
    while abs(right - left) > 1 {
        let mid = left + (right - left) / 2
        
        if Int(ary[mid])! < key {
            left = mid
            
        } else {
            right = mid
        }
    }
    return left
}

func arrangement (prev:String, ary:[String], returnVal:[String]) -> [String] {
    var returnVal = returnVal
    if ary.count == 0 {
        returnVal.append(prev)
        return returnVal
    }
    
    for s in ary {
        let wprev = prev + s
        var wary = ary
        wary.remove(s)
        returnVal = arrangement(prev: wprev, ary: wary, returnVal: returnVal)
    }
    return returnVal
}

func main() {
    let n = readInt()
    let aryS = readLine()!.map { String($0) }
    //＿＿＿＿＿＿＿＿＿＿＿＿＿＿＿＿＿＿＿＿＿＿＿＿＿＿＿＿＿＿＿＿ここまで入力
    var left = 0
    var right = 0
    for i in 0..<n / 2 {
        if aryS[i] == "W" {
            left += 1
        }
        if aryS[n - 1 - i] == "R" {
            right += 1
        }
    }
    print(left == 0 || right == 0 ? 0: max(left, right))
    
}
main()