use std::io;

fn main() {
    let mut x = String::new();
    io::stdin().read_line(&mut x).expect("error");
    let mut i = x.split_whitespace();
    let a:u64 = i.next().unwrap().parse().expect("error");
    let b:usize = i.next().unwrap().parse().expect("error");
    let mut v:Vec<u64> = Vec::new();
    for i in 1..(a as f64).sqrt() as u64+1 {
        if a % i == 0 {
            &v.push(i);
        }
    }
    let len = v.len();
    if b <= len {
        println!("{}", v[b-1]);
    } else if v[len-1]*v[len-1] == a && b <= 2*len-2 {
        println!("{}", a/v[2*len-2-b]);
    } else if v[len-1]*v[len-1] < a && b <= 2*len {
        println!("{}", a/v[2*len-b]);
    } else {
        println!("-1");
    }

}


use std::io;

fn main() {
    let mut input_str = String::new();
    io::stdin().read_line(&mut input_str).expect("read error");

    let input: Vec<i64>  = input_str.split_whitespace()
        .map(|x| x.parse::<i64>().expect("parse error"))
        .collect();

    let n = input[0];
    let k = input[1];

    let mut divisors: Vec<i64> = vec![];
    for divisor in 1..n {
        if divisor * divisor > n { break; }
        if n % divisor == 0 { divisors.push(divisor); }
    }

    let another_divisors: Vec<i64>;
    {
        another_divisors = divisors.iter().map(|x| n / x).rev().collect()
    }

    divisors.extend(another_divisors);

    if (divisors.len() as i64) < k {
        println!("-1");
    } else {
        println!("{}", divisors[k as usize - 1]);
    }
}


use std::io::stdin;
use std::cmp::max;

fn main() {
    let mut str = String::new();
    let _ = stdin().read_line(&mut str).unwrap();
    let mut iter = str.split_whitespace();
    let mut n:i64 = iter.next().unwrap().parse().unwrap();
    let mut k:i64 = iter.next().unwrap().parse().unwrap();
    let mut b_k = k + 2;
    let mut pow = 1;
    loop {
        if b_k > 1{
            pow *= 2;
            b_k /= 2;
        } else { break; }
    }
    pow /= 2;
    let mut  res = n / pow;
    while (res + 1) * pow + (k - 2 * pow + 1) <= n { res +=1; }
    while res * pow + (k - 2 * pow  + 1) > n { res -=1; }

    println!("{}", res);
    //println!("{}", pow);
}
//4 5 8 9 10 11
//5 -> 3 ->
//3 -> 1

// k <= 2 + 4 + 8 + .. pow => k + 2 <= 2 * pow
// 2 + 4 +8 + .. + pow = 2
// 6 * 2 + (5 - 2)
// 2 + 4 + 8 //+ 16  20 - 2,4,8 = 6 .. 2 * 8 = 16 + (20 - 2 - 4 - 8 - 1) = 21

// 5 - 2,2 - 1, 4


// https://codeforces.com/contest/1271/problem/E
//
#![allow(unused_imports)]
use std::io::*;
use std::fmt::*;
use std::str::*;
use std::cmp::*;
use std::collections::*;

#[allow(unused_macros)]
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
    ($($r:tt)*) => {
        let s = {
            use std::io::Read;
            let mut s = String::new();
            std::io::stdin().read_to_string(&mut s).unwrap();
            s
        };
        let mut iter = s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
}

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

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

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

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

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

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

    ($iter:expr, switch) => {
        {
            let ty = read_value!($iter, i32);
            if ty == 1 {
                vec![ty, read_value!($iter, i32), read_value!($iter, i32)]
            } else if ty == 2 {
                vec![ty, read_value!($iter, i32)]
            } else {
                vec![ty, read_value!($iter, i32)]
            }
        }
    };

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

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

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

#[allow(unused_macros)]
macro_rules! dvec {
    ($t:expr ; $len:expr) => {
        vec![$t; $len]
    };

    ($t:expr ; $len:expr, $($rest:expr),*) => {
        vec![dvec!($t; $($rest),*); $len]
    };
}

#[allow(unused_macros)]
macro_rules! ifv {
    ($t:expr, $a:expr, $b: expr) => {
        if $t { $a } else { $b }
    }
}

#[allow(unused_macros)]
macro_rules! fill {
    ($t:expr, $v:expr) => {
        for i in 0..$t.len() {
            $t[i] = $v;
        }
    };
}

#[allow(unused_macros)]
macro_rules! join {
    ($t:expr, $glue:expr) => {
        $t.into_iter().map(|w| w.to_string()).collect::<Vec<_>>().join($glue)
    };
}

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

fn exp(upto: usize, k: usize) {
    let mut cnt = vec![0; upto];
    for w in 1..upto {
        let mut ww = w;
        loop {
            cnt[ww] += 1;
            if ww == 1 {
                break;
            }
            if ww % 2 == 0 {
                ww /= 2;
            } else {
                ww -= 1;
            }
        }
    }
    let mut up = 0;
    for w in (1..upto).rev() {
        if cnt[w] > up {
            up = cnt[w];
            // debug!(w, up);
        }
    }
    for w in (1..upto).rev() {
        if cnt[w] >= k {
            println!("{}", w);
            break;
        }
    }
}

fn main() {
    input! {
        n: i64, k: i64
    };

    if n <= 100 {
        exp((n+1) as usize, k as usize);
        return;
    }

    let mut ans = -1;
    let mut tbl = vec![(n, 1), (n-1, ifv!(n % 2 == 0, 1, 2)), (n-2, ifv!(n % 2 == 0, 2, 1))];
    loop {
        // debug!(tbl);
        for &(f, l) in &tbl {
            if k <= l {
                ans = f;
                break;
            }
        }
        if tbl[0].0 <= 1 {
            break;
        }
        if ans != -1 {
            break;
        }

        let mut ntbl: Vec<(i64, i64)> = vec![];
        let tn = tbl.len();
        for nex in 0..4 {
            let to = tbl[0].0 / 2 - nex;
            let mut add = 1;

            // find 2*to
            {
                let mut f2 = false;
                for f in 0..tn {
                    if tbl[f].0 == 2*to {
                        add += tbl[f].1;
                        f2 = true;
                        break;
                    }
                }
                if !f2 {
                    for f in (0..tn).rev() {
                        if tbl[f].0 % 2 == 0 {
                            add += tbl[f].1;
                            break;
                        }
                    }
                }
            }

            // find to+1
            if to % 2 == 0 {
                // we already have that one...
                if nex >= 1 {
                    add += ntbl[(nex-1) as usize].1;
                } else {
                    for f in (0..tn).rev() {
                        if tbl[f].0 % 2 == 1 {
                            add += tbl[f].1;
                            break;
                        }
                    }
                }
            }
            ntbl.push((to, add));
        }
        tbl = ntbl;
    }

    // exp((n+1) as usize);
    println!("{}", ans);
}


//https://qiita.com/tanakh/items/0ba42c7ca36cd29d0ac8 より
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
    ($($r:tt)*) => {
        let s = {
            use std::io::Read;
            let mut s = String::new();
            std::io::stdin().read_to_string(&mut s).unwrap();
            s
        };
        let mut iter = s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
}

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

macro_rules! read_value {
    ($iter:expr, ( $($t:tt),* )) => {
        ( $(read_value!($iter, $t)),* )
    };
    ($iter:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($iter, $t)).collect::<Vec<_>>()
    };
    ($iter:expr, chars) => {
        read_value!($iter, String).chars().collect::<Vec<char>>()
    };
    ($iter:expr, usize1) => {
        read_value!($iter, usize) - 1
    };
    ($iter:expr, $t:ty) => {
        $iter.next().unwrap().parse::<$t>().expect("Parse error")
    };
}

// ここまで

fn run() {
    input! {
        n: u64,
    }
    if n <= 2 {
        println!("1");
        return;
    }
    let mut m = 4;
    let mut d = 1;
    while m + 1 < n {
        m = 2 * m - d;
        d ^= 1;
    }
    if m == n || m + 1 == n {
        println!("1");
    } else {
        println!("0");
    }
}

fn main() {
    run();
}


fn input_split() -> Vec<u8> {
    let mut buf = String::new();
    std::io::stdin().read_line(&mut buf).unwrap();
    buf.trim()
        .split_whitespace()
        .map(|elem| elem.parse().unwrap())
        .collect()
}

fn main() {
    let mut bags = input_split();
    bags.sort_unstable();
    print!(
        "{}",
        if bags[0] + bags[3] == bags[1] + bags[2] {
            "YES"
        } else {
            "NO"
        }
    );
}


struct Scan {
    buffer: std::collections::VecDeque<String>,
}

impl Scan {
    fn new() -> Scan {
        Scan {
            buffer: std::collections::VecDeque::new(),
        }
    }

    fn next<T: std::str::FromStr>(&mut self) -> T {
        loop {
            if let Some(token) = self.buffer.pop_front() {
                break token.parse::<T>().ok().unwrap();
            }
            let mut line = String::new();
            std::io::stdin().read_line(&mut line).expect("Fail to read");
            self.buffer = line.split_whitespace().map(String::from).collect();
        }
    }

    fn next_n<T: std::str::FromStr>(&mut self, n: usize) -> Vec<T> {
        (0..n).map(|_| self.next::<T>()).collect()
    }
}

fn _main() {
    let mut scan = Scan::new();
    let mut arr: Vec<usize> = scan.next_n(4);
    arr.sort();
    if arr[0] + arr[3] == arr[1] + arr[2] {
        println!("YES");
    } else {
        println!("NO");
    }
}

fn main() {
    std::thread::Builder::new()
        .stack_size(1 << 23)
        .spawn(_main)
        .unwrap()
        .join()
        .unwrap();
}


#![allow(unused_imports)]
use std::io::{self, BufWriter, Write};
use std::str::{self, SplitAsciiWhitespace};
use std::cmp::Ordering::{*};

// I have no idea what I'm doing

use std::f64::consts::{PI};

fn main() -> Result<(), io::Error> {
    let (stdin, stdout) = (io::stdin(), io::stdout());
    let mut scan = UnsafeScanner::new(stdin.lock());
    let mut out = BufWriter::new(stdout.lock());

    let n: i64 = scan.token();

    let is_in = |i, j| i*i + j*j <= n*n;
    // Uncomment for a cool circle in your screen
    // for i in -n..=n {
    //     for j in -n..=n {
    //         write!(out, "{}", if is_in(i.abs(), j.abs()) { '+' }
    //                           else { '-' })?;
    //         write!(out, " ")?;
    //     }
    //     writeln!(out)?;
    // }

    let mut ans = 0;
    let mut y = n;
    for x in 0..=n {
        if is_in(x, y) {
            ans += 1;
        }
        while !is_in(x, y) {
            y -= 1;
            ans += 1;
        }
    }

    writeln!(out, "{}", (ans - 1) * 4)?;

    Ok(())
}

///////////////////////////////////////////////////////////////////////////////////////////////////

/// Copied from https://github.com/EbTech/rust-algorithms/blob/master/src/scanner.rs
/// Same API as Scanner but nearly twice as fast, using horribly unsafe dark arts
/// **REQUIRES** Rust 1.34 or higher
pub struct UnsafeScanner<R> {
    reader: R,
    buf_str: Vec<u8>,
    buf_iter: SplitAsciiWhitespace<'static>,
}

impl<R: io::BufRead> UnsafeScanner<R> {
    pub fn new(reader: R) -> Self {
        Self {
            reader,
            buf_str: vec![],
            buf_iter: "".split_ascii_whitespace(),
        }
    }

    /// This function should be marked unsafe, but noone has time for that in a
    /// programming contest. Use at your own risk!
    pub fn token<T: str::FromStr>(&mut self) -> T {
        loop {
            if let Some(token) = self.buf_iter.next() {
                return token.parse().ok().expect("Failed parse");
            }
            self.buf_str.clear();
            self.reader
                .read_until(b'\n', &mut self.buf_str)
                .expect("Failed read");
            self.buf_iter = unsafe {
                let slice = str::from_utf8_unchecked(&self.buf_str);
                std::mem::transmute(slice.split_ascii_whitespace())
            }
        }
    }

    pub fn pair<T: str::FromStr>(&mut self) -> (T, T) {
        (self.token(), self.token())
    }
}


#![allow(unused_imports)]
use std::io::{ self, Write };
use std::str::FromStr;
use std::cmp::{ min, max };
use std::collections::{ BinaryHeap, VecDeque };

macro_rules! trace {
    ($var:expr) => ({
        let _ = writeln!(&mut std::io::stderr(), ">>> {} = {:?}", stringify!($var), $var);
    })
}
macro_rules! swap { ($a:expr, $b:expr) => ({ let t = $b; $b = $a; $a = t; }) }

fn bi(x: i64, n: i64, l0: i64, r0: i64) -> i64 {
    let mut left = l0;
    let mut right = r0;

    while right - left > 1 {
        let y = (left + right) / 2;
        if x * x + y * y <= n * n {
            left = y;
        } else {
            right = y;
        }
    }
    return left;
}

fn main() {
    let mut sc = Scanner::new();

    let n: i64 = sc.cin();

    if n == 0 {
        println!("1");
        return;
    }

    let mut a = 0;
    let mut b = 0;

    let mut l0 = 0;
    let mut r0 = n + 1;
    for x in 0..n {
        let y = bi(x, n, l0, r0);
        l0 = y - 10;
        r0 = y + 10;
        // trace!((x, y));
        if x < y {
            a += 1;
        } else if x == y {
            b += 1;
            break;
        } else {
            break;
        }
    }
    let ans = 4 * (a * 2 - 1 + b);
    println!("{}", ans);
}

#[allow(dead_code)]
struct Scanner { stdin: io::Stdin, buffer: VecDeque<String>, }
#[allow(dead_code)]
impl Scanner {
    fn new() -> Scanner { Scanner { stdin: io::stdin(), buffer: VecDeque::new() } }
    fn reserve(&mut self) {
        while self.buffer.len() == 0 {
            let mut line = String::new();
            let _ = self.stdin.read_line(&mut line);
            for w in line.split_whitespace() {
                self.buffer.push_back(String::from(w));
            }
        }
    }
    fn cin<T: FromStr>(&mut self) -> T {
        self.reserve();
        match self.buffer.pop_front().unwrap().parse::<T>() {
            Ok(a) => a,
            Err(_) => panic!("parse err")
        }
    }
    fn get_char(&mut self) -> char {
        self.reserve();
        let head = self.buffer[0].chars().nth(0).unwrap();
        let tail = String::from( &self.buffer[0][1..] );
        if tail.len()>0 { self.buffer[0]=tail } else { self.buffer.pop_front(); }
        head
    }
}


use std::cmp::*;

const INF: i64 = 1e12 as i64;
fn main() {
    let (n, m, k) = {
        let r = getvec::<i64>();
        (r[0], r[1], r[2])
    };
    let num = m - n;
    let l_n = k;
    let r_n = n - k + 1;
    let mut lb = 0i64;
    let mut ub = INF;
    while ub - lb > 1i64 {
        let mid = (ub + lb) / 2;
        let r = calc(max(1i64, mid - r_n + 1), mid);
        let l = calc(max(1i64, mid - l_n + 1), mid);
        let res = r + l - mid;
        if res <= num {
            lb = mid;
        } else {
            ub = mid;
        }
    }
    println!("{}", lb + 1);
}

fn calc(l: i64, r: i64) -> i64 {
    let n = r - l + 1;
    let res = n * (l + r);
    res / 2
}

#[allow(dead_code)]
fn next_line() -> String {
    let mut input = String::new();
    std::io::stdin().read_line(&mut input).unwrap();
    input
}

#[allow(dead_code)]
fn getnum<T: std::str::FromStr>() -> T {
    let res = next_line();
    res.trim().parse::<T>().ok().unwrap()
}

#[allow(dead_code)]
fn getvec<T: std::str::FromStr>() -> Vec<T> {
    let res = next_line();
    res.split_whitespace().map(|x| x.parse::<T>().ok().unwrap()).collect()
}


#![allow(unused_imports)]
use std::io::*;
use std::cmp::*;
use std::collections::*;

macro_rules! debug(
    ($($arg:tt)*) => { {
        let r = writeln!(&mut ::std::io::stderr(), $($arg)*);
        r.expect("failed printing to stderr");
    } }
);

struct Scanner {
   buffer : std::collections::VecDeque<String>
}

impl Scanner {

   fn new() -> Scanner {
      Scanner {
         buffer: std::collections::VecDeque::new()
      }
   }

   fn process(&mut self) -> String {
      if self.buffer.len() == 0 {
         let mut input = String::new();
         std::io::stdin().read_line(&mut input).ok();
         for word in input.split_whitespace() {
            self.buffer.push_back(word.to_string())
         }
      }

      self.buffer.pop_front().unwrap()
   }

   fn next<T : std::str::FromStr >(&mut self) -> T {
      self.process().parse::<T>().ok().unwrap()
   }

   #[allow(dead_code)]
   fn next_char(&mut self) -> char {
      self.process().into_bytes()[0] as char
   }
}

fn cost(x : i64, n : i64, k : i64) -> i64 {
   let left_limit = min(k, x - 1);
   let right_limit = min(n - k - 1, x - 1);

   let left_cost = left_limit*x - (left_limit*(left_limit+1)/2);
   let right_cost = right_limit*x - (right_limit*(right_limit+1)/2);

   let left_extra = max(k - left_limit, 0);
   let right_extra = max((n - k - 1) - right_limit, 0);

   x + left_cost + right_cost + left_extra + right_extra
}

fn search(n : i64, k : i64, m : i64) -> i64 {
   let mut upper = m;
   let mut lower = 1;
   let mut middle = 0;

   while lower <= upper {
      middle = (lower + upper)/2;
      let c = cost(middle, n, k);

      if c < m {
         lower = middle + 1;
      } else if c > m {
         upper = middle - 1;
      } else {
         break;
      }
   }

   middle
}

fn main() {
   let mut sin = Scanner::new();
   let (n, m, k) : (i64, i64, i64) = (sin.next(), sin.next(), sin.next());

   println!("{}", search(n, k - 1, m));
}


use std::io;

fn readstring() -> String {
    read_string_from_buffer(&io::stdin())
}

fn readint() -> i32 {
    read_int_from_buffer(&io::stdin())
}

fn read_string_from_buffer(buf: &io::Stdin) -> String {
    let mut input_text = String::new();
    buf.read_line(&mut input_text)
        .expect("failed to read from stdin");
    input_text.trim_right().to_string()
}

fn read_int_from_buffer(buf: &io::Stdin) -> i32 {
    read_string_from_buffer(buf)
        .parse::<i32>()
        .expect("couldn't parse data to an integer")
}

fn read_line_of_integers() -> Vec<i32> {
    readstring()
        .split_whitespace()
        .map(|x| x.parse::<i32>().unwrap())
        .collect()
}

fn read_line_of_longs() -> Vec<i64> {
    readstring()
        .split_whitespace()
        .map(|x| x.parse::<i64>().unwrap())
        .collect()
}

fn main() {
    let v = read_line_of_integers();
    let (n, a, b) = (v[0], v[1] - 1, v[2] - 1);

    let mut m = 1;
    let mut ans = 0;
    while a / m != b / m {
        m *= 2;
        ans += 1;
    }

    if m == n {
        println!("Final !")
    } else {
        println!("{}", ans);
    }
}


fn main() {
    let mut input = String::new();
    use std::io;
    use std::io::prelude::*;
    io::stdin().read_to_string(&mut input).unwrap();

    let mut it = input.split_whitespace();

    let n: usize = it.next().unwrap().parse().unwrap();
    let a: usize = it.next().unwrap().parse().unwrap();
    let b: usize = it.next().unwrap().parse().unwrap();

    let oa = a - 1;
    let ob = b - 1;

    let mut flag = n >> 1;
    let mut i = 0;

    while flag & oa == flag & ob {
        i += 1;
        flag = flag >> 1;
    }

    if i == 0 {
        println!("Final!");
    } else {
        println!("{}", n / 2usize.pow(i + 1));
    }
}


use std::io;
use std::io::Read;

fn main() {
    let mut stdin = String::new();
    io::stdin().read_to_string(&mut stdin).unwrap();
    let mut stdin = stdin.split_whitespace();
    let mut get = || stdin.next().unwrap();
    macro_rules! get {
        ($t:ty) => (get().parse::<$t>().unwrap());
    }

    let n = get!(usize);
    let need = get!(u64);

    let mut costs = vec![0; n];

    for i in 0..n {
        costs[i] = get!(u64);
    }

    fn search(costs: &Vec<u64>, need: u64, payment: u64) -> u64 {
        let mut best_payment = 0;
        for i in 0..costs.len() {
            let liters = 1 << i;
            if liters < need {
                let bottles = need / liters;
                let remains = need-bottles*liters;
                let payment = payment+bottles*costs[i];
                let payment = if remains > 0 {
                    search(costs, remains, payment)
                } else {
                    payment
                };
                if payment < best_payment || best_payment == 0 {
                    best_payment = payment;
                }
            } else {
                let payment = payment+costs[i];
                if payment < best_payment || best_payment == 0 {
                    best_payment = payment;
                }
            }
        }
        best_payment
    }

    let best_payment = search(&costs, need, 0);
    println!("{}", best_payment);
}


use std::io::stdin;

use std::cmp::{min,max};

fn main() {
    let a = {
        let mut input = String::new();
        stdin().read_line(&mut input).unwrap();
        input.trim().chars().map(|k| k.to_digit(10).unwrap()).collect::<Vec<_>>()
    };

    let la: Vec<_> = a.iter().cloned().take(3).collect();
    let ra: Vec<_> = a.iter().cloned().skip(3).collect();

    let l: u32 = a.iter().cloned().take(3).sum();
    let r: u32 = a.iter().cloned().skip(3).sum();

    let diff = r as i32 - l as i32;

    if diff == 0 {
        println!("0");
        std::process::exit(0);
    }

    let (mut up, mut down) = if diff > 0 {
        (ra, la)
    } else {
        (la, ra)
    };

    let mut v = Vec::new();
    v.append(&mut up);
    v.append(&mut down);

    for a in v.iter_mut().skip(3) {
        *a = 9 - *a;
    }

    let diff = diff.abs();

    let mut sum = 0u32;

    for (i, k) in v.into_iter().rev().enumerate() {
        if sum >= diff as u32 {
            println!("{}", i);
            std::process::exit(0);
        }
        sum += k;
    }
}


/// ========== 入力用マクロ ====================================================
/// https://qiita.com/tanakh/items/0ba42c7ca36cd29d0ac8 より
/// FromStr型, Vec<T: FromStr>, Vec<char>, に対応;
///
/// 入力と平行して処理したいときには使えない -> 後述の read() を使用
#[macro_export]
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)*}
    };
}

#[macro_export]
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)*}
    };
}

#[macro_export]
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")
    };
}

// ========== 常用関数 =======================================================
pub use std::f64::consts::PI;

// 10^9 + 7 で割ったあまりを出力してください
pub const MOD: u64 = 1_000_000_007;

// atcoder文字列, 使うときは`main()`内にコピペ
// let atcoder: Vec<char> = vec!['a', 't', 'c', 'o', 'd', 'e', 'r'];

/// 標準入力から
/// 空白文字で囲まれた1つのトークンを
/// 指定の型に変換する
pub fn read<T: std::str::FromStr>() -> T {
    use std::io::Read;
    let stdin = std::io::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")
}

/// 標準入力から1行読み取り
/// 空白文字で区切って
/// 指定の型の`Vec`に格納する
pub 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()
}

/// ユークリッドの互除法より
/// 2数の最大公約数を求める
pub fn gcd(arg1: usize, arg2: usize) -> usize {
    let mut u = if arg1 > arg2 { arg1 } else { arg2 };
    let mut v = if arg1 > arg2 { arg2 } else { arg1 };
    let mut r: usize;
    while v != 0 {
        r = u % v;
        u = v;
        v = r;
    }
    u
}

/// `Vec<usize>` に対して順に `gcd()` を適用して
/// 配列全体の最大公約数を求める
pub fn gcd_vec(v: &[usize]) -> usize {
    let mut r = v[0];
    for i in &v[1..] {
        r = gcd(r, *i);
    }
    r
}

/// `gcd()` を利用して2数の最小公倍数を求める
pub fn lcm(arg1: usize, arg2: usize) -> usize {
    arg1 * arg2 / gcd(arg1, arg2)
}

/// `Vec<usize>` に対して順に`lcm()` を適用して
/// 配列全体の最小公倍数を求める
pub fn lcm_vec(v: &[usize]) -> usize {
    let mut r = v[0];
    for i in &v[1..] {
        r = lcm(r, *i);
    }
    r
}

/// 与えられた `char` が母音であれば `true` を返す
pub fn is_vowel(c: char) -> bool {
    match c {
        'a' | 'i' | 'u' | 'e' | 'o' => true,
        _                           => false,
    }
}

/// プログラムを終了
pub fn exit() {
    std::process::exit(0)
}

// ========== main() ==========================================================

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

    let a_count = s.iter().filter(|x| **x == 'a').count();
    let not_a = s.len() - a_count;
    let ans = if a_count > not_a {
        0
    } else {
        not_a - a_count + 1
    };
    println!("{}", ans);
}


use std::io;

fn main() {
  let mut si = String::new();
  io::stdin().read_line(&mut si).unwrap();
  let sf = si.trim().matches("a").collect::<Vec<&str>>().len();
  println!("{}", sf+1);
}


use std::io;

fn main() {
    let mut s = String::new();
    io::stdin().read_line(&mut s).unwrap();
    let mut arr : Vec<i32> = s.split_whitespace().map(|s| s.parse().unwrap()).collect();
    let n = arr[0];
    let k = arr[1];
    arr = s.split_whitespace().map(|s| s.parse().unwrap());
    let mut ans = 0;
    let mut reff : i32 = 0;
    for (i, x) in arr.enumerate() {
        if i == k-1 {
            reff = x;
        }
        if i < k || x == reff {
            ans ++;
        }
    }
    println!("{}", ans);
}


#![allow(non_snake_case)]
#![allow(unused_must_use)]
#![allow(unused_variables)]
#![allow(dead_code)]

pub fn main() {
    let nk = rus();
    let n = nk[0];
    let k = nk[1];
    let ss = rus();

    let t = ss[k as usize - 1];
    let mut c = 0;

    if t == 0 {
        for &s in &ss {
            if s == 0 {
                println!("{}", c);
                return;
            } else {
                c += 1;
            }
        }
    } else {
        for i in k..n {
            if ss[i as usize] == t {
                c += 1;
            } else {
                println!("{}", k + c);
                return;
            }
        }
    }
    println!("{}", n);
}

//read u64
fn ru() -> u64 {
    let mut string = String::new();
    std::io::stdin().read_line(&mut string);
    string.trim().parse::<u64>().unwrap()
}

//read u64 vec
fn rus() -> Vec<u64> {
    let mut string = String::new();
    std::io::stdin().read_line(&mut string);
    string.split_whitespace().map(|x| x.parse::<u64>().unwrap())
        .collect::<Vec<_>>()
}

//read i64
fn ri() -> i64 {
    let mut string = String::new();
    std::io::stdin().read_line(&mut string);
    string.trim().parse::<i64>().unwrap()
}

//read i64 vec
fn ris() -> Vec<i64> {
    let mut string = String::new();
    std::io::stdin().read_line(&mut string);
    string.split_whitespace().map(|x| x.parse::<i64>().unwrap())
        .collect::<Vec<_>>()
}

use std;

trait UU<T> {
    fn uu(self) -> T;
}

impl<T> UU<T> for Option<T> {
    fn uu(self) -> T {
        self.unwrap()
    }
}


use std::io;

fn main() {
    let mut buf = String::new();
    io::stdin().read_line(&mut buf).unwrap();
    let mut s = buf.split_whitespace();
    let n: usize = s.next().unwrap().trim().parse().unwrap();
    let k: usize = s.next().unwrap().trim().parse().unwrap();
    let mut buf = String::new();
    io::stdin().read_line(&mut buf).unwrap();
    let mut s = buf.split_whitespace();
    let mut a = Vec::new();
    for _ in 0..n {
        let t: u32 = s.next().unwrap().trim().parse().unwrap();
        a.push(t);
    }
    let bound = if a[k - 1] > 0 { a[k - 1] } else { 1 };
    let mut res = 0;
    while a[res] >= bound {
        res += 1;
    }
    println!("{}", res);
}


use std::io::BufRead;

fn read_player_count_and_last_good_index() -> (u64, u64) {
    let mut buf = String::new();
    std::io::stdin().read_line(&mut buf).unwrap();
    let mut iter = buf.split_whitespace().map(|x| x.parse::<u64>());
    (iter.next().unwrap().unwrap(), iter.next().unwrap().unwrap() - 1)
}

fn count_good_players(player_count: u64, last_good_index: u64) -> u64 {
    let mut count: u64 = 0;
    let stdin = std::io::stdin();
    let mut iter = stdin.lock().split(b' ');

    for _ in 0..last_good_index {
        let buf = iter.next().unwrap().unwrap();
        let score = std::str::from_utf8(buf.as_slice()).unwrap().trim().parse::<u64>().unwrap();
        if score == 0 {
            return count;
        }
        count += 1;
    }

    let buf = iter.next().unwrap().unwrap();
    let last_good_score = std::str::from_utf8(buf.as_slice()).unwrap().parse::<u64>().unwrap();
    if last_good_score == 0 {
        return count;
    }
    count += 1;

    if last_good_index + 1 == player_count {
        return count
    }

    loop {
        let buf = iter.next();
        if let None = buf {
            return count;
        }
        let score =
            std::str::from_utf8(buf.unwrap().unwrap().as_slice())
            .unwrap()
            .parse::<u64>()
            .unwrap();
        if score < last_good_score {
            break;
        }
        count += 1;
    }

    count
}

fn main() {
    let (player_count, last_good_index) = read_player_count_and_last_good_index();
    println!("{}", count_good_players(player_count, last_good_index));
}


use std::io::{Read, Write, stdin, stdout};

pub struct Scanner<U: Sized + Read> {
    pub buffer: Vec<String>,
    pub reader: U,
}
impl<U: Sized + Read> Scanner<U> {
    pub fn next<T: std::str::FromStr>(&mut self) -> T {
        loop {
            if let Some(token) = self.buffer.pop() {
                return token.parse().ok().expect("Failed parse");
            }
            let mut input = String::new();
            self.reader.read_to_string(&mut input).expect("Failed read");
            self.buffer = input.lines().rev().map(String::from).collect();
        }
    }

    pub fn new(reader: U) -> Self {
        return Scanner {
            buffer: vec![],
            reader,
        };
    }
}
pub fn solution_of_p158a(input: &mut Read, out: &mut Write) {
    let mut scanner = Scanner::new(input);

    let line1 = scanner.next::<String>();
    let line1_arr: Vec<usize> = line1.split(" ").map(|s| {
        return s.parse::<usize>().unwrap();
    }).collect();
    let k = line1_arr[1];

    let line2 = scanner.next::<String>();
    let line2_arr: Vec<usize> = line2.split(" ").map(|s| {
        return s.parse::<usize>().unwrap();
    }).collect();

    let mut res = 0;
    for item in &line2_arr {
        if item >= &line2_arr[k] && item > &0 {
            res += 1;
        }
    }

    write!(out, "{}\n", res).ok();
}

fn main() {
    solution_of_p158a(&mut stdin(), &mut stdout());
}


use std::io;

fn main() {
    let mut nkstr = String::new();
    io::stdin().read_line(&mut nkstr).unwrap();
    let nk: Vec<i8> = nkstr
        .trim()
        .split_whitespace()
        .map(|val| val.parse().unwrap())
        .collect();
    let mut astr = String::new();
    io::stdin().read_line(&mut astr).unwrap();
    let mut a: Vec<i8> = astr
        .trim()
        .split_whitespace()
        .map(|val| val.parse().unwrap())
        .collect();
    a.sort_unstable();
    a.reverse();
    let mut answer = 0;
    let mut i = 0;
    while a[i] >= a[nk[1] as usize] && a[i] > 0 {
        answer += 1;
        i += 1
    }
    println!("{}", answer);
}


#[allow(unused_imports)]
use std::io::{BufWriter, stdin, stdout, Write};

#[derive(Default)]
struct Scanner {
    buffer: Vec<String>
}
impl Scanner {
    fn next<T: std::str::FromStr>(&mut self) -> T {
        loop {
            if let Some(token) = self.buffer.pop() {
                return token.parse().ok().expect("Failed parse");
            }
            let mut input = String::new();
            stdin().read_line(&mut input).expect("Failed read");
            self.buffer = input.split_whitespace().rev().map(String::from).collect();
        }
    }
}

fn main() {
    let mut scan = Scanner::default();
    let n: (i32,i32) = (scan.next::<i32>(),scan.next::<i32>());
    let mut j : Vec<i32> = Vec::new();
    let mut result = 0i16;

    for _i in 0..n.0 {
        j.push(scan.next::<i32>());
    }

    for score in j {
        if score >= j(n.1) && score > 0 {
            result +=1;
        }
    }

    println!("{}", result);
}


#[allow(unused_imports)]
use std::io::{BufWriter, stdin, stdout, Write};

#[derive(Default)]
struct Scanner {
    buffer: Vec<String>
}
impl Scanner {
    fn next<T: std::str::FromStr>(&mut self) -> T {
        loop {
            if let Some(token) = self.buffer.pop() {
                return token.parse().ok().expect("Failed parse");
            }
            let mut input = String::new();
            stdin().read_line(&mut input).expect("Failed read");
            self.buffer = input.split_whitespace().rev().map(String::from).collect();
        }
    }
}

fn main() {
    let mut scan = Scanner::default();
    let n: (i32,i32) = (scan.next::<i32>(),scan.next::<i32>());
    let mut j = vec![0; n.0 as usize];
    let mut result = 0i16;

    for _i in 0..n.0 {
        j[_i as usize] = scan.next::<i32>();
    }

    for score in 0..n.0 {
        if j[score as usize] >= j[n.1 as usize] && j[score as usize] > 0{
            result +=1;
        }
    }

    println!("{}", result);
}


use std::io;

fn main() {
	let mut inp = String::new();
	let mut ans: i32 = 0;
	let k: u32;
	io::stdin().read_line(&mut inp).unwrap();
	k = inp
		.trim()
		.split_whitespace()
		.nth(1)
		.unwrap()
		.parse()
		.unwrap();
	inp.clear();
	io::stdin().read_line(&mut inp).unwrap();
	let mut balls: Vec<i32> = Vec::new();
	for i in inp.split_whitespace() {
		balls.push(i.parse().unwrap());
	}
	for i in 0..balls.len() {
		if balls[i as usize] >= balls[k as usize] && balls[i as usize] > 0 {
			ans += 1;
		}
	}
	println!("{}", ans);
}


fn readln() -> String {
    let stdin = std::io::stdin();
    let mut line = String::new();
    stdin.read_line(&mut line).unwrap();
    String::from(line.trim())
}

macro_rules! scanln {
    ($($ty: ty),*) => {{
        let line = readln();
        let mut iter = line.split_whitespace();
        ($(iter.next().unwrap().parse::<$ty>().unwrap()),*)
    }}
}

fn main() {
    let (n, mut k) = scanln!(i32, i32);
    let mut a: Vec<i32> = readln()
        .split_whitespace()
        .map(|e| e.parse().unwrap())
        .collect();
    a.sort();
    if k > n {
        k = n;
    }
    let a_k = a[a.len() - k as usize + 1];
    let make_it_through = a.iter()
        .filter(|&&a_i| a_i >= a_k && a_i > 0)
        .count();
    println!("{}", make_it_through);
}


use std::io::{self, BufRead, Write};

// score >= kth = pass
// n participants
//
// n = 8
// k = 5

fn main() -> io::Result<()> {
    let stdin = io::stdin();
    let mut lines = stdin.lock().lines();
    let stdout = io::stdout();
    let mut stdout = stdout.lock();

    let k = lines
        .next()
        .unwrap()
        .unwrap()
        .split_whitespace()
        .last()
        .unwrap()
        .parse::<usize>()
        .unwrap();

    writeln!(stdout, "{}", &calc(&lines.next().unwrap().unwrap(), k))?;

    Ok(())
}

fn calc(s: &str, k: usize) -> usize {
    let mut nums = s.split_whitespace().map(|s| s.parse().unwrap());
    for i in 0..k-1 {
        let n: usize = nums.next().unwrap();
        if n == 0 {
            return i;
        }
    }
    let n = nums.next().unwrap();
    if n == 0 {
        return k;
    }
    for i in 0.. {
        if nums.next().unwrap() != n {
            return k + i
        }
    }
    k
}

#[cfg(test)]
mod tests {

    use super::*;

    #[test]
    fn zeros() {
        let input = "0 0 0 0";
        let left = calc(input, 2);
        let right = 0;
        assert_eq!(left, right);
    }

    #[test]
    fn input1() {
        let input = "10 9 8 7 7 7 5 5";
        let left = calc(input, 5);
        let right = 6;
        assert_eq!(left, right);
    }

    #[test]
    fn wrong() {
        let input = "3 2 1 0 0";
        let left = calc(input, 5);
        let right = 3;
        assert_eq!(left, right);
    }
}


use std::io;

fn main() {
    let mut intro = String::new();
    io::stdin().read_line(&mut intro).unwrap();

    let (n, k) = intro.split_at(1);
    let n: u8 = n.trim().parse().unwrap();
    let k: u8 = k.trim().parse().unwrap();

    let mut input = String::new();
    io::stdin().read_line(&mut input).unwrap();

    let mut iter = input.split_whitespace();

    let mut output: u8 = 0;
    let mut cut_off: u8 = 0;

    for i in 0..n {
        let num = iter.next().unwrap();
        let num: u8 = num.parse().unwrap();

        if num == 0 { break; }

        if i < k  { output += 1; }
        else if i == k {
            cut_off = num;
            output += 1;
         }
        else if num >= cut_off {
            output += 1;
        }
        else { break; }
    }

    println!("{}", output);
}


use std::io;

fn main() {
    let mut limits = String::new();

    io::stdin().read_line(&mut limits).expect("unknown error");

    let mut scores = String::new();

    io::stdin().read_line(&mut scores).expect("unknown error");

    let n: usize = limits
        .split(" ")
        .next()
        .unwrap()
        .trim()
        .parse()
        .expect("Not a number");
    let k: usize = limits
        .split(" ")
        .last()
        .unwrap()
        .trim()
        .parse()
        .expect("Not a number");

    let scores: Vec<u32> = scores
        .trim()
        .split_whitespace()
        .map(|s| s.parse().expect("parse error"))
        .collect();

    let mut answer: u32 = 0;

    for i in 0..n {
       if let (Some(val_1), Some(val_2)) =
       (&scores.get(i), &scores.get(k)){
            if val_1 >= val_2 && val_1 > 0{
                answer+=1;
            }
       }
    }

    println!("{}", answer);
}


fn main() {

    let mut first_input = String::new();
    std::io::stdin()
            .read_line(&mut first_input)
            .expect("Value not found");

    let inputs: Vec<&str> = first_input.split_whitespace().collect();
    let num_contestant: i32 = inputs[0].parse().unwrap();
    let k_positon: i32 = inputs[1].parse().unwrap();
    // let num_contestant = num_contestant - 1;

    if (k_positon > num_contestant) || (num_contestant > 50) {
        return ()
    }

    // println!("n = {} k = {}", num_contestant, k_positon);

        let mut second_input = String::new();
        std::io::stdin()
                .read_line(&mut second_input)
                .expect("Value not found");

        let score_input: Vec<i32> = second_input.split_whitespace()
                                              .map(|s| s.parse()
                                              .expect("parse error"))
                                              .collect();

        let count: usize = score_input.len();
        let contestant_input_count: usize = inputs[0].parse().unwrap();
        // println!("score_input = {:?} count = {} ", score_input, count);
        // println!("contestant_input_count = {}", contestant_input_count);

        if  (contestant_input_count != count) || (count > 100) {
            return ()
        }

        // println!("Score input at 0: {:?}", score_input[0]);

        let mut i: usize = 0;
        for _i in 0..contestant_input_count-1 {
            if (score_input[i] > score_input[i+1]) || (score_input[i] == score_input[i+1]) {
                // println!("Check Sucess, {}", i); // don't need to compare the last element of the vector
                // so therefore  contestant_input_count - 1
                i = i + 1;
            }
            else {
                break;
            }
        }
        // let mut i: usize = 0;
        // while i < count-1 {
        //     if ( score_input[i] > score_input[i+1] ) || (score_input[i] == score_input[i+1]) {
        //         println!("check sucess, {}",i);
        //     }
        //     else {
        //         break;
        //     }
        //    i += 1;
        // }
        // let mut i: usize = 0;

        let mut final_count: usize = 0;
        let mut i: usize = 0;
        let k: usize = inputs[1].parse().unwrap();
        for _i in &score_input {
                if (score_input[k] <= score_input[i]) && (score_input[i] > 0) {
                final_count = final_count + 1;
                i += 1;
                }
            }
            println!("{}", final_count);
}


use std::io::{self, prelude::*};
use std::str;

struct Scanner<R> {
    reader: R,
    buf_str: Vec<u8>,
    buf_iter: str::SplitWhitespace<'static>,
}
impl<R: io::BufRead> Scanner<R> {
    fn new(reader: R) -> Self {
        Self { reader, buf_str: Vec::new(), buf_iter: "".split_whitespace() }
    }
    fn next<T: str::FromStr>(&mut self) -> T {
        loop {
                if let Some(token) = self.buf_iter.next() {
                    return token.parse().ok().expect("Failed parse");
                }
                self.buf_str.clear();
                self.reader.read_until(b'\n', &mut self.buf_str).expect("Failed read");
                self.buf_iter = unsafe {
                    let slice = str::from_utf8_unchecked(&self.buf_str);
                    std::mem::transmute(slice.split_whitespace())
            }
        }
    }
}

fn main() {

    let (stdin, stdout) = (io::stdin(), io::stdout());
    let mut scan = Scanner::new(stdin.lock());
    let mut out = io::BufWriter::new(stdout.lock());

    let (n,k,mut cnt) = (scan.next::<usize>(),scan.next::<usize>(),0);
    let v = (0..n).map(|_| scan.next::<i32>()).collect::<Vec<i32>>();
    if v[k]!=0 {
        for i in k..n {
            if v[i]!=v[k-1] {
                break;
            }
            cnt+=1;
        }
        writeln!(out,"{}",k+cnt).ok();
    } else {
        for i in (0..k-1).rev() {
            if v[i]!=v[k-1] {
                break;
            }
            cnt+=1;
        }
        writeln!(out,"{}",k-cnt-1).ok();
    }
}


fn main(){
    let mut input = 1;  let mut whiteCount = 0; let mut blackCount = 0;
    while i <= 8{
        let mut input1 = String::new();
        let b1 = std::io::stdin().read_line(&mut input1).unwrap();

        for contC in input.chars(){
            blackCount += calcular_black(contC); whiteCount += calcular_white(contC);

        }
        i += 1;
    }

    if whiteCount <  blackCount
        println!("Black");
    }
    else if whiteCount > blackCount{
        println!("White");
    }
    else{
        println!("Draw");
    }
 }

fn calcular_white(c:char) -> i32{
    match c{ 'Q'=> 9, 'R'=> 5, 'B'=> 3,'N'=> 3,'P'=> 1, _  => 0,}

}
fn calcular_black(c:char) -> i32{
    match c{ 'q'=> 9, 'r'=> 5,'b'=> 3,'n'=> 3,'p'=> 1, _  => 0, }

}


fn contar_negras (vector_c: &Vec<char>) -> i32 {
    let mut negras: i32 = 0;

    for caracter in vector_c{
        match caracter{
            'q' => negras +=9,
            'r' => negras +=5,
            'b' => negras +=3,
            'n' => negras +=3,
            'p' => negras +=1,
            _ => negras +=0,
        }
    }
    negras
}

fn contar_blancas (vector_c: &Vec<char>) -> i32 {
    let mut blancas: i32 = 0;

    for caracter in vector_c{
        match caracter{
            'Q' => blancas +=9,
            'R' => blancas +=5,
            'B' => blancas +=3,
            'N' => blancas +=3,
            'P' => blancas +=1,
            _ => blancas +=0,
        }
    }
    blancas
}

fn main() {
    use std::io::{stdin};
    let mut blanco :i32 = 0;
    let mut negro :i32 = 0;
    let mut s=String::new();
    for _ in 0..8{
        stdin().read_line(&mut s).expect("Error");
        let char_vec: Vec<char> = s.chars().collect();
        negro = contar_negras(&char_vec);
        blanco = contar_blancas(&char_vec);
    }
    if blanco > negro {
        println!("White");
    } else {
        println!("Black");
    }
    //println!("{}, {}",negro, blanco);
}


fn main() {
    let mut word = String::new();
    std::io::stdin().read_line(&mut word).unwrap();

    let word = word.trim();
    let len = word.len();
    let mut i: usize = 0;

    while i < len {
        if i <= len - 3 &&
            word.as_bytes()[i] == b'W' &&
            word.as_bytes()[i + 1] == b'U' &&
            word.as_bytes()[i + 2] == b'B' {
                i += 3;
        }
        else {
            print!("{}", word.as_bytes()[i] as char);
            i += 1;
        }
    }

    println!();
}


fn main() {
    let mut word = String::new();
    std::io::stdin().read_line(&mut word).unwrap();

    let word = word.trim();
    let len = word.len();
    let mut i: usize = 0;

    while i < len {
        if i <= len - 3 {
            if word.as_bytes()[i] == b'W' &&
                word.as_bytes()[i + 1] == b'U' &&
                word.as_bytes()[i + 2] == b'B' {
                println!(" ");
                i += 3;
            }
        }
        else {
            print!("{}", word.as_bytes()[i] as char);
            i += 1;
        }
    }

    println!();
}


#![allow(unused_parens)]
#![allow(unused_imports)]
#![allow(non_upper_case_globals)]
#![allow(non_snake_case)]
#![allow(unused_mut)]
#![allow(unused_variables)]
#![allow(dead_code)]

#[allow(unused_macros)]
macro_rules! invec {
    ( $ t : ty ) => {{
        let mut s = String::new();
        match std::io::stdin().read_line(&mut s) {
            Ok(0) => Vec::<$t>::new(),
            Ok(n) => s
                .trim()
                .split_whitespace()
                .map(|s| s.parse::<$t>().unwrap())
                .collect::<Vec<$t>>(),
            Err(_) => Vec::<$t>::new(),
        }
    }};
}

#[allow(unused_macros)]
macro_rules! get {
      ($t:ty) => {
          {
              let mut line: String = String::new();
              std::io::stdin().read_line(&mut line).unwrap();
              line.trim().parse::<$t>().unwrap()
          }
      };
      ($($t:ty),*) => {
          {
              let mut line: String = String::new();
              std::io::stdin().read_line(&mut line).unwrap();
              let mut iter = line.split_whitespace();
              (
                  $(iter.next().unwrap().parse::<$t>().unwrap(),)*
              )
          }
      };
      ($t:ty; $n:expr) => {
          (0..$n).map(|_|
              get!($t)
          ).collect::<Vec<_>>()
      };
      ($($t:ty),*; $n:expr) => {
          (0..$n).map(|_|
              get!($($t),*)
          ).collect::<Vec<_>>()
      };
      ($t:ty ;;) => {
          {
              let mut line: String = String::new();
              std::io::stdin().read_line(&mut line).unwrap();
              line.split_whitespace()
                  .map(|t| t.parse::<$t>().unwrap())
                  .collect::<Vec<_>>()
          }
      };
      ($t:ty ;; $n:expr) => {
          (0..$n).map(|_| get!($t ;;)).collect::<Vec<_>>()
      };
}

#[allow(unused_macros)]
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
    ($($r:tt)*) => {
        let mut s = {
            use std::io::Read;
            let mut s = String::new();
            std::io::stdin().read_to_string(&mut s).unwrap();
            s
        };
        let mut iter = s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
}

macro_rules! input_inner {
    ($iter:expr) => {};
    ($iter:expr, ) => {};

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

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

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

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

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

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

#[allow(unused_macros)]
#[cfg(debug_assertions)]
macro_rules! mydbg {
    //($arg:expr) => (dbg!($arg))
    //($arg:expr) => (println!("{:?}",$arg));
      ($($a:expr),*) => {
          eprintln!(concat!($(stringify!($a), " = {:?}, "),*), $($a),*);
      }
}
#[cfg(not(debug_assertions))]
macro_rules! mydbg {
    ($($arg:expr),*) => {};
}

macro_rules! echo {
    ($($a:expr),*) => {
          $(println!("{}",$a))*
      }
}

use std::cmp::*;
use std::collections::*;
use std::ops::{Add, Div, Mul, Sub};

#[allow(dead_code)]
static INF_I64: i64 = i64::max_value() / 2;
#[allow(dead_code)]
static INF_I32: i32 = i32::max_value() / 2;
#[allow(dead_code)]
static INF_USIZE: usize = usize::max_value() / 2;
#[allow(dead_code)]
static M_O_D: usize = 1000000007;
#[allow(dead_code)]
static PAI: f64 = 3.1415926535897932;

trait IteratorExt: Iterator {
    fn toVec(self) -> Vec<Self::Item>;
}

impl<T: Iterator> IteratorExt for T {
    fn toVec(self) -> Vec<Self::Item> {
        self.collect()
    }
}

trait CharExt {
    fn toNum(&self) -> usize;
    fn toAlphabetIndex(&self) -> usize;
    fn toNumIndex(&self) -> usize;
}
impl CharExt for char {
    fn toNum(&self) -> usize {
        return *self as usize;
    }
    fn toAlphabetIndex(&self) -> usize {
        return self.toNum() - 'a' as usize;
    }
    fn toNumIndex(&self) -> usize {
        return self.toNum() - '0' as usize;
    }
}

trait VectorExt {
    fn joinToString(&self, s: &str) -> String;
}
impl<T: ToString> VectorExt for Vec<T> {
    fn joinToString(&self, s: &str) -> String {
        return self
            .iter()
            .map(|x| x.to_string())
            .collect::<Vec<_>>()
            .join(s);
    }
}

trait StringExt {
    fn get_reverse(&self) -> String;
}
impl StringExt for String {
    fn get_reverse(&self) -> String {
        self.chars().rev().collect::<String>()
    }
}

trait UsizeExt {
    fn pow(&self, n: usize) -> usize;
}
impl UsizeExt for usize {
    fn pow(&self, n: usize) -> usize {
        return ((*self as u64).pow(n as u32)) as usize;
    }
}

fn main() {
    let n = get!(usize);
    let a = invec!(usize);
    let mut ans = 0;
    let mut p = 0;
    for i in 0..n {
        mydbg!(p);
        let item = a[i];
        if item == 0 {
            p = item;
            ans += 1;
        } else if item != 3 && item != p {
            p = item;
        } else if item == 3 && p != 0 {
            p = if p == 1 { 2 } else { 1 };
        } else if item == 3 && p == 0 {
            if i + 1 != n {
                let next = a[i + 1];
                p = if next == 1 { 2 } else { 1 };
            } else {
                p = 1;
            }
        } else {
            p = 0;
            ans += 1;
        }
    }
    echo!(ans);
}


// 991E
use std::io;

fn main() {
    let mut a = String::new();
    io::stdin().read_line(&mut a).unwrap();
    let a = a.trim();

    let mut counts = [0u64; 10];

    for c in a.chars() {
        counts[c.to_digit(10).unwrap() as usize] += 1;
    }

    let mut fa = [0u64; 30];

    let with_zero = count(&mut counts, 0, &mut fa);
    let mut correct = with_zero;
    if counts[0] > 0 {
        counts[0] = 0;
        correct -= count(&mut counts, 0, &mut fa);
    }
    println!("{}", correct);
}

fn factorial(n: u64, fa: &mut [u64]) -> u64 {
    if n == 0 {
        fa[n as usize] = 1;
    } else if fa[n as usize] == 0 {
        fa[n as usize] = factorial(n - 1, fa) * n;
    }
    return fa[n as usize];
}

fn count(counts: &mut [u64], change_here: usize, fa: &mut [u64]) -> u64 {
    if change_here == 10 {
        // All numbers are fixed now
        let numerator = factorial(counts.iter().sum(), fa);
        let mut denominator = 1;
        for c in counts {
            denominator *= factorial(*c, fa);
        }
        return numerator / denominator;
    }

    if counts[change_here] == 0 {
        return count(counts, change_here + 1, fa);
    }

    let mut add = 0;
    for i in 1..(counts[change_here] + 1) {
        counts[change_here] = i;
        add += count(counts, change_here + 1, fa);
    }
    return add;
}


#![allow(unused_imports, unused_variables, dead_code, non_snake_case, unused_macros)]
use std::io::{stdin, Read, StdinLock};
use std::str::FromStr;
use std::fmt::*;
use std::str::*;
use std::cmp::*;
use std::collections::*;

fn getline() -> String{
    let mut res = String::new();
    std::io::stdin().read_line(&mut res).ok();
    res
}

macro_rules! readl {
    ($t: ty) => {
        {
            let s = getline();
            s.trim().parse::<$t>().unwrap()
        }
    };
    ($( $t: ty),+ ) => {
        {
            let s = getline();
            let mut iter = s.trim().split(' ');
            ($(iter.next().unwrap().parse::<$t>().unwrap(),)*)
        }
    };
}

macro_rules! readlvec {
    ($t: ty) => {
        {
            let s = getline();
            let iter = s.trim().split(' ');
            iter.map(|x| x.parse().unwrap()).collect::<Vec<$t>>()
        }
    }
}

macro_rules! mvec {
    ($v: expr, $s: expr) => {
        vec![$v; $s]
    };
    ($v: expr, $s: expr, $($t: expr),*) => {
        vec![mvec!($v, $($t),*); $s]
    };
}

macro_rules! debug {
    ($x: expr) => {
        println!("{}: {:?}", stringify!($x), $x)
    }
}

fn printiter<'a, T>(v: &'a T)
where
    &'a T: std::iter::IntoIterator,
    <&'a T as std::iter::IntoIterator>::Item: std::fmt::Display {
    for (i,e) in v.into_iter().enumerate() {
        if i != 0 {
            print!(" ");
        }
        print!("{}", e);
    }
    println!("");
}

struct ContestPrinter {
    s: String,
}

impl ContestPrinter {
    fn new() -> ContestPrinter {
        ContestPrinter {
        s: String::new(),
        }
    }

    fn print<T>(&mut self, x: T)
        where T: std::fmt::Display {
        self.s.push_str(format!("{}", x).as_str());
    }

    fn println<T>(&mut self, x: T)
        where T: std::fmt::Display {
        self.s.push_str(format!("{}\n", x).as_str());
    }
}

impl std::ops::Drop for ContestPrinter {
    fn drop(&mut self) {
        print!("{}", self.s);
    }
}

fn main() {
    let mut printer = ContestPrinter::new();

    let (A, B) = readl!(i64, i64);
    let (mut a, mut b) = (A, B);
    loop {
        if (a == 0) | (b == 0) { break; }
        else if a >= (2*b) {
            a -= 2*b;
        } else if b >= (2*a) {
            b -= 2*a;
        } else {
            break;
        }
    }
    println!("{} {}", a, b);
}


use std::io;
use std::io::Stdin;
use std::str::FromStr;

fn read_line(stdin : &Stdin, line : &mut String) {
    match stdin.read_line(line) {
        Ok(_) => return,
        Err(msg) => panic!("Could not read line! Message: {}.", msg),
    }
}

fn parse_t<T : FromStr>(s : &str) -> T {
    match s.trim().parse() {
        Ok(y) => y,
        Err(_) => panic!("Could not read from string!"),
    }
}

fn read_ts<T : FromStr>(stdin : &Stdin, ts : &mut Vec<T>) {
    let mut line = String::new();
    read_line(stdin, &mut line);
    let word_iter = line.split_whitespace();
    for word in word_iter {
        let x = parse_t(word);
        ts.push(x);
    }
}

fn process(a : u64, b : u64) -> (u64, u64) {
    let mut m_a = a;
    let mut m_b = b;
    loop {
        if (m_a == 0) || (m_b == 0) {
            break;
        } else {
            let two_m_a = 2 * m_a;
            let two_m_b = 2 * m_b;
            if m_a >= two_m_b {
                m_a = m_a - two_m_b;
            } else if m_b >= two_m_a {
                m_b = m_b - two_m_a;
            } else {
                break;
            }
        }
    }
    (m_a, m_b)
}

fn main() {
    let stdin = io::stdin();
    let mut a_b = vec![];
    read_ts(&stdin, &mut a_b);
    let (c, d) = process(a_b[0], a_b[1]);
    println!("{} {}", c, d);
}


use std::io;
use std::ascii::AsciiExt;

pub fn main() {
    let stdin = io::stdin();
    let mut line = String::new();
    stdin.read_line(&mut line).unwrap();

    print!("{}", modify(&line));
}

pub fn modify(input: &str) -> String {
    let mut output = String::new();

    for c in input.bytes().map(|c| c.to_ascii_lowercase()) {
        match c {
            b'a' | b'o' | b'y' | b'e' | b'u' | b'i' => {}
            _ => {
                output.push('.');
                output.push(c as char);
            }
        }
    }

    output
}

#[cfg(test)]
mod tests {
    use super::*;

    #[test]
    fn it_works() {
        assert_eq!(".t.r", modify("tour"));
        assert_eq!(".c.d.f.r.c.s", modify("Codeforces"));
        assert_eq!(".b.c.b", modify("aBAcAba"));
    }
}


use std::io::Read;

fn input(read_file: bool) -> String {
    if read_file {
        let mut file = std::fs::File::open("sample.txt").unwrap();
        let mut buf = String::new();
        file.read_to_string(&mut buf).unwrap();
        buf
    } else {
        let mut buf = String::new();
        std::io::stdin().read_to_string(&mut buf).unwrap();
        buf.trim_end().to_owned()
    }
}

fn solve(ws: &mut std::str::SplitWhitespace) {
    let s: Vec<char> = ws.next().unwrap().chars().collect();
    let set = "aiueo"
        .chars()
        .map(|c| c)
        .collect::<std::collections::HashSet<_>>();
    let ans: Vec<char> = s
        .iter()
        .map(|c| c.to_ascii_lowercase())
        .filter(|c| !set.contains(c))
        .collect();

    let ans: String = ['.']
        .iter()
        .cycle()
        .zip(ans)
        .fold(String::from(""), |mut ss, (&c1, c2)| {
            ss.push(c1);
            ss.push(c2);
            ss
        });

    println!("{}", ans);
}

fn main() {
    const READ_FROM_FILE: bool = false;

    let s = input(READ_FROM_FILE);
    let mut ws = s.split_whitespace();

    // let t = ws.next().unwrap().parse().unwrap();
    // for _ in 0..t {}
    solve(&mut ws);
}


use std::io::{stdin, stdout, StdinLock, StdoutLock, BufReader, BufWriter, prelude::*};

#[allow(unused_macros)]
macro_rules! spread {
    ($w: expr, $v: expr) => {
        for x in $v.iter() {
            write!($w, "{} ", x).unwrap();
        }
        writeln!($w).unwrap();
    };
}

#[allow(dead_code)]
fn parse<T: std::str::FromStr>(x: &str) -> T {
    match x.trim().parse::<T>() {
        Ok(n) => n,
        _ => panic!("")
    }
}

#[allow(dead_code)]
fn input(r: &mut BufReader<StdinLock>, cap: usize) -> String {
    let mut t = String::with_capacity(cap);
    r.read_line(&mut t).unwrap();

    if t.ends_with('\n') {
        t.pop();
        if t.ends_with('\r') {
            t.pop();
        }
    }

    t
}

fn main() {
    let stdin = stdin();
    let stdout = stdout();

    solve(&mut BufReader::new(stdin.lock()), &mut BufWriter::new(stdout.lock()));
}

#[allow(unused_variables)]
#[allow(clippy::many_single_char_names)]
fn solve(r: &mut BufReader<StdinLock>, w: &mut BufWriter<StdoutLock>) {
    let s = input(r, 100);
    let mut v = String::with_capacity(s.len()<<1);

    for c in s.chars() {
        let c = if (c as u8) < 97 {((c as u8) + 32) as char} else {c};
        match c {
            'a' | 'e' | 'i' | 'o' | 'u' => {},
            _ => {
                v.push('.');
                v.push(c);
            }
        }
    }
    write!(w, "{}", v);
}


use std::io;
use regex::Regex;

fn main() {
    let mut s = String::new();
    io::stdin().read_line(&mut s).unwrap();

    println!("{}", Expr::new().calc(&s));
}

struct Expr(Vec<Regex>);

impl Expr {
    fn new() -> Expr {
        let r1 = Regex::new(r"(?i)[aeiou]").unwrap();
        let r2 = Regex::new(r"(?i)([bcdfghjklmnpqrstvwxyz])").unwrap();
        Expr(vec![r1, r2])
    }

    fn calc(&self, s: &str) -> String {
        self.0[1].replace_all(&*self.0[0].replace_all(s, ""), ".$1").to_lowercase()
    }
}

#[cfg(test)]
mod tests {
    use super::*;

    #[test]
    fn test_vowels_removed() {
        assert_eq!(Expr::new().calc("aeiou"), "");
    }

    #[test]
    fn test_vowels_removed_from_mix() {
        assert_eq!(Expr::new().calc("abcdefg"), ".b.c.d.f.g");
    }

    #[test]
    fn test_dot_only_consonants() {
        assert_eq!(Expr::new().calc("zxy"), ".z.x.y");
    }

    #[test]
    fn test_upper_consonants() {
        assert_eq!(Expr::new().calc("RZW"), ".r.z.w");
    }
}


use std::io;

fn main() {
    let mut s = String::new();
    io::stdin().read_line(&mut s).unwrap();

    println!("{}", calc(&s));
}

fn calc(s: &str) -> String {
    let mut res = String::with_capacity(110);
    for c in s.trim().chars() {
        match c.to_ascii_lowercase() {
            c if "aeiou".contains(c) => (),
            c => res.push_str(&format!(".{}", c))
        }
    }
    res
}

#[cfg(test)]
mod tests {
    use super::*;

    #[test]
    fn test_vowels_removed() {
        assert_eq!(calc("aeiou"), "");
    }

    #[test]
    fn test_vowels_removed_from_mix() {
        assert_eq!(calc("abcdefg"), ".b.c.d.f.g");
    }

    #[test]
    fn test_dot_only_consonants() {
        assert_eq!(calc("zxy"), ".z.x.y");
    }

    #[test]
    fn test_upper_consonants() {
        assert_eq!(calc("RZW"), ".r.z.w");
    }

    #[test]
    fn test_tour() {
        assert_eq!(calc("tour "), ".t.r");
    }
}


// extern crate rand;
// #[macro_use]
// extern crate scan_rules;

use std::io;
// use rand::Rng;
// use std::cmp::Ordering;
fn main() {
	// let result=try_readln!{
	// 	(let a:u32,let b:u32) =>(a,b)
	// };
	// let mut n:u32=0;
	// let mut t:u32=0;
	// match result{
	// 	Ok((a,b))=>{
	// 		n=a;
	// 		t=b;
	// 	},
	// 	Err(e)=>println!("some error occured"),
	// };
	let mut some=String::new();
	io::stdin().read_line(&mut some).expect("Some error occured");
	let option=some.trim().split(" ").map(str::parse::<i32>).collect::<Vec<_>>();
	let n=match option[0]{
		Ok(num)=>num,
		Err(_)=>0,
	};
	let t=match option[1]{
		Ok(num)=>num,
		Err(_)=>0,
	};
	let mut queue=String::new();
	io::stdin().read_line(&mut queue)
		.expect("Error reading string");
	let queue=queue.trim();
	let mut a=Vec::new();
	for x in queue.chars(){
		if x=='G'{
			a.push(1);
		}
		else {
			a.push(0);
		}
	}
	for _x in 0..t{
		for i in (1..n).rev(){
			if a[i as usize]==1&&a[(i-1)as usize]==0{
				a[i as usize]=0;
				a[(i-1) as usize]=1;
			}
		}
	}
	for x in a{
		if x==1{
			print!("G");
		}
		else {
			print!("B");
		}
	}

}


#[allow(unused)] use std::io::*;
#[allow(unused)] use std::collections::*;
#[allow(unused)] use std::mem::*;
#[allow(unused)] use std::num::*;
#[allow(unused)] use std::cmp::*;
#[allow(unused)] fn strarr() -> Vec<String> {
    let mut inp = String::new();
    stdin().read_line(&mut inp).ok();
    inp.split(' ').map(|x| x.trim()).filter(|x| x.len() != 0).map(|x| x.to_string()).collect() }
#[allow(unused)] macro_rules! scan { ($($x:ty), +) => {{
    let s = strarr(); let mut cnt : usize = 0;
    fn next<T>(cnt: &mut usize, p: &Vec<String>) -> T
        where T:std::str::FromStr
        { *cnt += 1; p[*cnt-1].parse().ok().unwrap() }
    ($(next::<$x>(&mut cnt, &s)), +)
    }}; }
#[allow(unused)] macro_rules! arr { ($n:expr, $T:ty) => {{
    let mut s = strarr(); let mut v = Vec::new();
    for i in 0..$n { v.push(s[i as usize].parse::<$T>().unwrap()); } v
    }}; }

///////////////////////////////////////////////////////////////////////////////

fn main()
{
    let (n, t) = scan!(i32, i32);
    let mut s : Vec<char> = scan!(String).chars().collect();
    for _ in 0..t {
        for i in (0..n-1).rev() {
            if s[i as usize] == 'B' && s[(i+1) as usize] == 'G' {
                let t = s[i as usize];
                s[i as usize] = s[(i + 1) as usize];
                s[(i + 1) as usize] = t;
            }
        }
    }
    for c in s { print!("{}", c); } println!();
}


fn read<T:std::str::FromStr,P:std::str::FromStr>()->(T,P){
    let mut line=String::new();
    std::io::stdin().read_line(&mut line).expect("Ошибка в чтении");
    let mut line=line.split_whitespace();
    (
        match line.next().unwrap().parse::<T>(){
            Ok(n)=>n,
            Err(_)=>panic!("Ошибка в переводе"),
        },
        match line.next().unwrap().parse::<P>(){
            Ok(n)=>n,
            Err(_)=>panic!("Ошибка в переводе"),
        }
    )
}
fn main(){
    let (people,time)=read::<usize,usize>();
    let mut line=String::new();
    std::io::stdin().read_line(&mut line).unwrap();
    let mut queue:Vec<char>=line.trim().chars().collect();
    let mut girl:Vec<usize>=Vec::new();
    for i in 0..time{
        for c in (1..queue.len()).rev(){
            if queue[c-1]!='G'{
                let k=queue[c];
                queue[c]=queue[c-1];
                queue[c-1]=k
            }
        }
    }
    print!("{}",queue.into_iter().collect::<String>());
}


use std::io;

fn main() {
    let (num,turns,mut list)=input();
    for _ in 1..turns{
        for i in 1..num{
            if &list[i as usize].to_string()=="G" && &list[(i-1) as usize].to_string()=="B"{
                let boy=list[(i-1) as usize];
                list[(i-1) as usize]=list[i as usize];
                list[i as usize]=boy;
            }
        }
    }let mut sum=String::from("");
    for i in list{
        sum=sum+&i.to_string();
    }println!("{}",sum);
}

fn read() -> String{
    let mut input=String::new();
    io::stdin().read_line(&mut input).expect("unable to read");
    input.trim().to_string()
}

fn input() -> (i32,i32,Vec<char>){
    let inp=read();
    let list: Vec<_>=inp.split_whitespace().collect();
    let qu: Vec<_>=read().chars().collect();
    (list[0].parse::<i32>().expect("Failed to parse"),
    list[1].parse::<i32>().expect("Failed to parse"),qu)
}


// https://codeforces.com/problemset/problem/266/B

use std::io;

fn main() {
    let mut line = String::new();

    io::stdin()
        .read_line(&mut line)
        .unwrap();

    let words: Vec<i64> =
        line
        .split_whitespace()
        .map(|x| x.parse().unwrap())
        .collect();

    let n = words[0];
    let t = words[1];

    let mut s = String::new();

    io::stdin()
        .read_line(&mut s)
        .unwrap();

    let mut s: Vec<char> =
        s.chars().collect();

    let mut time = 0;

    while time < t {
        let mut idx: usize = 0;
        loop {
            if idx as i64 >= n {
                break;
            }
            if s[idx] == 'B' && s[idx+1] == 'G' {
                s[idx] = 'G';
                s[idx+1] = 'B';
                idx += 2;
            }
            idx += 1;
        }
        time += 1;
    }

    let answer: String = s.into_iter().collect();
    print!("{}", answer);
}


fn main() {
    let (len, itt) = parse_arg();
    let mut v = parse_vec();
    for _ in 0..itt {
        swaper(&mut v, len);
    }
    println!("{:?}", v);
}

#[derive(Debug, PartialEq)]
enum Gender {
    B,
    G,
}
fn parse_line() -> String {
    let mut text = String::new();
    std::io::stdin().read_line(&mut text).expect("msg: &str");
    String::from(text.trim())
}
fn parse_arg() -> (usize, usize) {
    let text = parse_line();
    let v: Vec<&str> = text.split_whitespace().collect();
    (v[0].parse().expect(""), v[1].parse().expect("msg: &str"))
}

fn parse_vec() -> Vec<Gender> {
    let text = parse_line();
    text.chars()
        .map(|c| if c == 'B' { Gender::B } else { Gender::G })
        .collect()
}
//5 1
//BGGBG

//GBGGB
fn swaper(v: &mut Vec<Gender>, len: usize) {
    let mut to_swap: Vec<(usize, usize)> = vec![];
    for i in 0..(len - 1) {
        if v[i] == Gender::B && v[i + 1] == Gender::G {
            to_swap.push((i, i + 1))
        }
    }
    for (i, i2) in to_swap {
        v.swap(i, i2)
    }
}


use std::str::FromStr;

fn read_str() -> String {
    let mut buffer: String = String::new();
    std::io::stdin().read_line(&mut buffer).expect("Error");
    buffer.trim().to_string()
}

fn read_vec<T: FromStr>(split_char: char) -> Vec<T> {
    read_str()
        .split(split_char)
        .map(|value| value.parse::<T>().ok().expect("Error"))
        .collect()
}

fn main() {
    let times: u8 = read_vec(' ')[1];
    let mut queue: String = read_str();

    for _ in 0..times {
        let mut current: String = String::new();
        let mut flag: bool = false;
        let length: usize = queue.len();

        for pos in 0..length {
            if flag {
                flag = false;
                continue;
            }

            if pos + 2 < length {
                if &queue[pos..pos + 2] == "BG" {
                    current.push_str("GB");
                    flag = true;
                    continue;
                }
            }
            current.push_str(&queue[pos..pos + 1]);
        }
        queue = current.clone();
    }
    println!("{}", queue);
}


fn main() {
    let (n, t) = {
        let mut buf = String::new();
        std::io::stdin().read_line(&mut buf).unwrap();
        let mut ws = buf.split_whitespace();
        let n: usize = ws.next().unwrap().parse().unwrap();
        let t: usize = ws.next().unwrap().parse().unwrap();
        (n, t)
    };
    let s = {
        let mut buf = String::new();
        std::io::stdin().read_line(&mut buf).unwrap();
        buf.trim_end().to_owned()
    };
    let v: Vec<char> = s.chars().collect();
    let mut w: Vec<(char, bool)> = Vec::with_capacity(n);
    for i in 0..n {
        w.push((v[i], false));
    }

    for i in 0..n {
        if w[i] == ('B', false) {
            w.insert(std::cmp::min(i + t + 1, n), ('B', true));
            w.remove(i);
        }
    }

    let a = w.iter().map(|x| x.0).collect::<String>();
    println!("{}", a);
}


fn readln() -> Vec<i32> {
    let mut line = String::new();
    std::io::stdin().read_line(&mut line).unwrap();

    line.split_whitespace()
        .map(|s| s.parse().unwrap())
        .collect()
}

fn main() {
    let input = readln();

    let n = input[0];
    let t = input[1];

    let mut line = String::new();
    std::io::stdin().read_line(&mut line).unwrap();

    let mut chars: Vec<char> = Vec::new();
    for ch in line.chars() {
        chars.push(ch);
    }

    for _ in (0..t).rev() {
        for i in 1..n {
            if chars[(i - 1) as usize] == 'B' && chars[i as usize] == 'G' {
                chars.swap((i - 1) as usize, i as usize);
            }
        }
    }

    for ch in chars {
        print!("{}", ch);
    }
}


#[allow(unused_imports)]
use std::cmp::{min,max};
use std::io::{BufWriter, stdin, stdout, Write};

#[derive(Default)]
struct Scanner {
    buffer: Vec<String>
}
impl Scanner {
    fn next<T: std::str::FromStr>(&mut self) -> T {
        loop {
            if let Some(token) = self.buffer.pop() {
                return token.parse().ok().expect("Failed parse");
            }
            let mut input = String::new();
            stdin().read_line(&mut input).expect("Failed read");
            self.buffer = input.split_whitespace().rev().map(String::from).collect();
        }
    }
}

fn main() {
    let mut scan = Scanner::default();
    let out = &mut BufWriter::new(stdout());

    // how to read
    let n = scan.next::<usize>()-1;
    let t = scan.next::<i16>();
    let mut s: Vec<char> = scan.next::<String>().chars().collect();
    let mut r = String::new();

    for _i in 0..t {
        let mut j:usize = 0;
        loop {
            println!("{:?} {:?} {:?}", s, r, j);
            if j == n {
                r.push(s[j]);
                break;
            } else if j > n {
                break;
            } else if s[j] == 'B' && s[j+1] == 'G' {
                r.push('G');
                r.push('B');
                j += 2;
            } else {
                r.push(s[j]);
                j += 1;
            }
        }
        s = r.chars().collect();
        r = String::new();
    }
    // how to output
    let s : String = s.into_iter().collect();
    writeln!(out, "{}", s).ok();

}


#![allow(non_snake_case, unused_imports, deprecated, dead_code)]

// Input 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)*} }; }
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)*} }; ($next:expr, mut $var:ident : $t:tt $($r:tt)*) => { let mut $var = read_value!($next, $t); input_inner!{$next $($r)*} }; }
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, [ $t:tt ]) => { { let len = read_value!($next, usize); (0..len).map(|_| read_value!($next, $t)).collect::<Vec<_>>() } }; ($next:expr, chars) => { read_value!($next, String).chars().collect::<Vec<char>>() }; ($next:expr, bytes) => { read_value!($next, String).into_bytes() }; ($next:expr, usize1) => { read_value!($next, usize) - 1 }; ($next:expr, $t:ty) => { $next().parse::<$t>().expect("Parse error") }; }

// Module
use std::cmp::{min,max};
use std::collections::{VecDeque,HashMap,HashSet,BTreeMap,BTreeSet,BinaryHeap};
// Module for v1.15.1
use std::ascii::AsciiExt; // deprecated since 1.26.0: use inherent method instead

// Functions

// Main
fn main() {

    input! {
        N: usize,
        T: usize,
        mut S: chars
    }

    for _ in 0..T {
        for i in 1..N {
            if S[N-1-i]=='B' && S[N-i]=='G' {
                S[N-1-i] = 'G';
                S[N-i]   = 'B';
            }
        }
    }

    println!("{}", S.iter().collect::<String>());
}


fn main() {
    let mut text = String::new();
    std::io::stdin().read_line(&mut text).unwrap();
    let val: u64 = text.trim().parse().unwrap();
    let mut i = 1;
    let value = loop {
        if (i * (i + 1)) / 2 >= val {
            break i;
        }
        i += 1;
    };
    println!("{}", value)
}


fn main() {
    let mut text = String::new();
    std::io::stdin().read_line(&mut text).unwrap();
    let val: u64 = text.trim().parse().unwrap();
    let mut i = 1;
    let mut step = 0;
    let mut last = 0;
    while step < val {
        for a in 1..i {
            if step < val {
                last = a;
            }
            step += 1;
        }
        i += 1;
    }
    println!("{}", last)
}


fn main() {
    let mut input = String::new();
    std::io::stdin().read_line(&mut input).expect("INPUT::Read line failed");

    let number = input.trim().parse::<i32>().expect("NUMBER::Parse to i32 failed");

    let mut vec = vec![];
    let mut fx = function(number);
    let mut is_repeats = is_repeat(&vec, fx);

    while !is_repeats {
        vec.push(fx);
        fx = function(fx);
        is_repeats = is_repeat(&vec, fx);

    }

    println!("{}",vec.len() + 1 );

}

fn function(number : i32) -> i32 {
    let mut number = number + 1;

    let mut last_number = number % 10;

    while last_number == 0 {
        number /= 10;
        last_number = number % 10;
    }

    number

}

fn is_repeat(vec : &Vec<i32>, fx:i32) -> bool {
    let mut is_repeat = false;

    for i in 0..vec.len() {
        if fx == vec[i] {
            is_repeat = true;
            break;
        }

    }
    is_repeat
}


// http://codeforces.com/contest/1157/problem/A

use std::io;

fn read_int32s() -> Vec<i32> {
    let mut buf = String::new();
    io::stdin().read_line(&mut buf).ok().expect("");
    let src:Vec<&str> = buf.trim().split(' ').collect();
    let mut result: Vec<i32> = Vec::new();
    for e in src {
        let n:Result<i32, _> = e.parse();
        result.push(n.unwrap());
    }
    result
}

fn f(x:i32) -> i32
{
    let mut y = x + 1;
    while (y % 10) == 0
    {
        y = y / 10;
    }
    y
}

fn main()
{
    let n = read_int32s()[0];
    let mut x = n;
    let mut cnt = 1;
    loop
    {
        x = f(x);
        cnt += 1;
        if x < 10
        {
            cnt += 8;
            break;
        }
    }
    println!("{}", cnt);
}


use std::cmp::min;

fn get_max_days(a: u32, b: u32, c: u32) -> u32 {
    let full_week_num: u32 = min(a / 3, min(b / 2, c / 2));
    let a_rest: u32 = a - 3 * full_week_num;
    let b_rest: u32 = b - 2 * full_week_num;
    let c_rest: u32 = c - 2 * full_week_num;

    let mut extra_days_max: u32 = 0;
    for start_weekday in 0..6 {
        let mut weekday: u32 = start_weekday;
        let mut extra_days: u32 = 0;
        let mut a_rest1: u32 = a_rest;
        let mut b_rest1: u32 = b_rest;
        let mut c_rest1: u32 = c_rest;
        loop {
            if (weekday == 0) || (weekday == 3) || (weekday == 6) {
                if a_rest1 > 0 {
                    a_rest1 -= 1;
                } else {
                    break;
                }
            }
            else if (weekday == 1) || (weekday == 5) {
                if b_rest1 > 0 {
                    b_rest1 -= 1;
                } else {
                    break;
                }
            }
            else {
                if c_rest1 > 0 {
                    c_rest1 -= 1;
                } else {
                    break;
                }
            }

            extra_days += 1;
            weekday += 1;
            weekday %= 7;
        }

        if extra_days > extra_days_max {
            extra_days_max = extra_days;
        }
    }

    return 7 * full_week_num + extra_days_max;
}

#[cfg(test)]
mod tests {
    use super::get_max_days;

    #[test]
    fn test1() {
        assert_eq!(get_max_days(2, 1, 1), 4);
    }
    #[test]
    fn test2() {
        assert_eq!(get_max_days(3, 2, 2), 7);
    }
    #[test]
    fn test3() {
        assert_eq!(get_max_days(1, 100, 1), 3);
    }
    #[test]
    fn test4() {
        assert_eq!(get_max_days(30, 20, 10), 39);
    }
}

fn read_data() -> (u32, u32, u32) {
    let mut data_str: String = String::new();
    std::io::stdin().read_line(&mut data_str).unwrap();

    let data_values: Vec<u32> = data_str
        .trim()
        .split(" ")
        .map(|s| s.parse::<u32>().unwrap())
        .collect();

    return (data_values[0], data_values[1], data_values[2]);
}

fn main() {
    let (a, b, c): (u32, u32, u32) = read_data();

    let max_days: u32 = get_max_days(a, b, c);

    println!("{}", max_days);
}


use std::io;
use std::str;

pub struct Scanner<R> {
    reader: R,
    buffer: Vec<String>,
}

impl<R: io::BufRead> Scanner<R> {
    pub fn new(reader: R) -> Self {
        Self {
            reader,
            buffer: vec![],
        }
    }

    pub fn token<T: str::FromStr>(&mut self) -> T {
        loop {
            if let Some(token) = self.buffer.pop() {
                return token.parse().ok().expect("Failed parse");
            }
            let mut input = String::new();
            self.reader.read_line(&mut input).expect("Failed read");
            self.buffer = input.split_whitespace().rev().map(String::from).collect();
        }
    }
}

fn solve<R: io::BufRead, W: io::Write>(scan: &mut Scanner<R>, out: &mut W) {
    let n: i64 = scan.token();
    let x: i64 = scan.token();
    // In how many ways we can express x as p * q, where 1 <= p, q <= n ?
    let mut ans = 0;
    let mut p = 1;
    while p * p <= x {
        if x % p == 0 {
            let q = x / p;
            if q <= n {
                ans += 1;
            }
        }
        p += 1;
    }
    ans *= 2;
    if (p - 1) * (p - 1) == x {
        ans -= 1;
    }
    writeln!(out, "{}", ans).ok();
}

fn main() {
    let (stdin, stdout) = (io::stdin(), io::stdout());
    let mut scan = Scanner::new(stdin.lock());
    let mut out = io::BufWriter::new(stdout.lock());
    solve(&mut scan, &mut out);
}


type Pair = (u32, u32);
fn input_pair() -> Pair {
    let mut buf = String::new();
    std::io::stdin().read_line(&mut buf).unwrap();
    let buf: Vec<u32> = buf
        .trim()
        .split_whitespace()
        .map(|elem| elem.parse().unwrap())
        .collect();
    (buf[0], buf[1])
}

fn main() {
    let (n, x) = input_pair();
    let mut occurance_count = 0;
    for i in n / 2..n {
        if x % i == 0 {
            occurance_count += 2;
        }
    }

    println!("{}", occurance_count);
}


type Pair = (u32, u32);
fn input_pair() -> Pair {
    let mut buf = String::new();
    std::io::stdin().read_line(&mut buf).unwrap();
    let buf: Vec<u32> = buf
        .trim()
        .split_whitespace()
        .map(|elem| elem.parse().unwrap())
        .collect();
    (buf[0], buf[1])
}

fn main() {
    let (n, x) = input_pair();
    let mut occurance_count = 0;

    if n == 1 {
        if x == 1 {
            println!("1");
        } else {
            println!("0");
        }
    } else if n == 2 {
        if x == 1 || x == 4 {
            println!("1");
        } else if x == 2 {
            println!("2");
        } else {
            println!("0");
        }
    } else {
        for i in 2..=n {
            if x % i == 0 && x / i <= n {
                if x == i {
                    occurance_count += 2;
                } else {
                    occurance_count += 1;
                }
            }
        }
        println!("{}", occurance_count);
    }
}


// Vicfred
// https://codeforces.com/problemset/problem/577/A
use std::io;

fn main() {
    let mut line = String::new();

    io::stdin()
        .read_line(&mut line)
        .unwrap();

    let words: Vec<i64> =
        line
        .split_whitespace()
        .map(|x| x.parse().unwrap())
        .collect();

    let n = words[0];
    let x = words[1];

    let limit: i64 = f64::sqrt(x as f64) as i64;

    let mut ans = 0;

    for d in 1..=limit {
        if x%d == 0 && d <= n && x/d <= n {
            ans += 1;
        }
    }

    if x != 1 {
        ans *= 2;
    }

    if limit*limit == x && x != 1{
        ans -= 1;
    }

    println!("{}", ans);
}


use std::io;
use std::io::Read;

fn main() {
    let mut text = String::new();
    io::stdin().read_to_string(&mut text).unwrap();
    let mut iter = text.split_whitespace().map(|x| x.parse::<i64>().unwrap());
    let n = iter.next().unwrap();
    let x = iter.next().unwrap();
    println!("{}", (1..(n+1)).filter(|i| x % i == 0).count())
}


#![allow(non_snake_case, unused_imports, deprecated, dead_code)]

// Input 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)*} }; }
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)*} }; ($next:expr, mut $var:ident : $t:tt $($r:tt)*) => { let mut $var = read_value!($next, $t); input_inner!{$next $($r)*} }; }
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, [ $t:tt ]) => { { let len = read_value!($next, usize); (0..len).map(|_| read_value!($next, $t)).collect::<Vec<_>>() } }; ($next:expr, chars) => { read_value!($next, String).chars().collect::<Vec<char>>() }; ($next:expr, bytes) => { read_value!($next, String).into_bytes() }; ($next:expr, usize1) => { read_value!($next, usize) - 1 }; ($next:expr, $t:ty) => { $next().parse::<$t>().expect("Parse error") }; }

// Module
use std::cmp::{min,max};
use std::collections::{VecDeque,HashSet,HashMap,BinaryHeap};
// Module for v1.15.1
use std::ascii::AsciiExt; // deprecated since 1.26.0: use inherent method instead

// Functions

// Main
fn main() {

    input! {
        N: usize,
        X: usize
    }

    let mut ans = 0;
    let primes = get_primes(N);
    for i in 1..N+1{
        if X%i==0 && X/i<=N {
            ans += 1;
        }
    }

    println!("{}", ans);
}


#[allow(unused_imports)]
use std::cmp::*;
#[allow(unused_imports)]
use std::collections::*;
use std::io::*;
#[allow(dead_code)]
fn getline() -> String {
    let mut ret = String::new();
    std::io::stdin().read_line(&mut ret).ok();
    return ret;
}
fn get_word() -> String {
    let mut stdin = std::io::stdin();
    let mut u8b: [u8; 1] = [0];
    loop {
        let mut buf: Vec<u8> = Vec::with_capacity(16);
        loop {
            let res = stdin.read(&mut u8b);
            if res.unwrap_or(0) == 0 || u8b[0] <= b' ' {
                break;
            } else {
                buf.push(u8b[0]);
            }
        }
        if buf.len() >= 1 {
            let ret = std::string::String::from_utf8(buf).unwrap();
            return ret;
        }
    }
}
fn parse<T: std::str::FromStr>(s: &str) -> T { s.parse::<T>().ok().unwrap() }

#[allow(dead_code)]
fn get<T: std::str::FromStr>() -> T { parse(&get_word()) }

fn main() {
    let k: i64 = get();
    let a: i64 = get();
    let b: i64 = get();
    let res: i64 = if (a < k && b < k) && (0 < a && 0 < b) {
        -1
    } else {
        a / k + b / k
    };
    println!("{}", res);
}


use std::io::BufRead;
use std::io::Write;

#[derive(Debug,Clone,Copy,Default)]
struct Problem {
    buf: [u8;9],
    len: u8,
}

impl Problem {
    fn as_slice(&self) -> &[u8] {
        &self.buf[0..self.len as usize]
    }
}

fn loc(d: u8) -> (u8,u8) {
    assert!(d < 10);
    if d == 0 {
        (1,3)
    } else {
        ((d-1)%3,(d-1)/3)
    }
}

fn read_problem() -> Problem {
    let stdin = std::io::stdin();
    let mut lines = stdin.lock().lines();

    let ct = str::parse::<u8>(&lines.next().unwrap().unwrap()).unwrap();
    let mut ret = Problem::default();
    for (c,b) in lines.next().unwrap().unwrap().chars().zip(ret.buf.iter_mut()) {
        *b = c.to_digit(10).unwrap() as u8;
        ret.len += 1;
    }
    assert_eq!(ret.len, ct);
    assert!(lines.next().is_none());
    ret
}

fn solve(problem: Problem) -> bool {
    let mut min_x = u8::max_value();
    let mut min_y = u8::max_value();
    let mut max_x = 0;
    let mut max_y = 0;
    let mut max_side_y = 0;

    for &d in problem.as_slice() {
        let (x,y) = loc(d);
        if x < min_x {
            min_x = x;
        } else if x > max_x {
            max_x = x;
        }
        if y < min_y {
            min_y = y;
        } else if y > max_y {
            max_y = y;
        }
        if x != 1 && y > max_side_y  {
            max_side_y = y;
        }
    }

    let dx = max_x - min_x;
    let dy = max_y - min_y;
    let dsy = max_side_y - min_y;
    writeln!(&mut std::io::stderr(), "{:?}", (dx,dy,dsy)).unwrap();
    dy == 3 || (dx,dsy) == (2,2)
}

fn main() {
    let p = read_problem();
    println!("{}", if solve(p) { "YES" } else { "NO" });
}


use std::io;
use std::io::Read;

fn main() {
    let mut text = String::new();
    io::stdin().read_to_string(&mut text).unwrap();
    let mut iter = text.split_whitespace();//.map(|x| x.parse::<i64>().unwrap());
    let n = iter.next().unwrap().parse::<i64>().unwrap();
    let s = iter.next().unwrap();
    let mut up = true;
    let mut down = true;
    let mut left = true;
    let mut right = true;
    for c in s.chars() {
        let d = c as i64 - '0' as i64;
        if d >= 1 && d <= 3 {
            up = false;
        }
        if d == 7 || d == 9 || d == 0 {
            down = false;
        }
        if d == 1 || d == 4 || d == 7 {
            left = false;
        }
        if d % 3 == 0 && d != 0 {
            right = false;
        }
    }
    println!("{}", if (up || down || left || right) {"NO"} else {"YES"});

}

fn get_pos(num: i64) -> (i64, i64) {
    if num == 0 {
        (3, 1)
    } else {
        ((num - 1) / 3, (num - 1) % 3)
    }
}


fn main() {
    let friend_count = get_input_usize();
    let finger_count: usize = get_input().split_ascii_whitespace().map(|v| v.parse::<usize>().unwrap()).sum();

    let total = friend_count + 1;
    let position = finger_count % total;

    let res = vec![1,2,3,4,5].iter().fold(0, |total, next| {
        if (next + position) % total == 0 {
            total
        } else {
            total + 1
        }
    });

    println!("{}", res);

}

fn get_input() -> String {
    let mut buffer = String::new();
    std::io::stdin().read_line(&mut buffer).expect("Failed");
    buffer.trim().to_owned()
}

fn get_input_usize() -> usize {
    get_input().parse().unwrap()
}


fn main() {
    let friend_count = get_input_usize();
    let finger_count: usize = get_input().split_ascii_whitespace().map(|v| v.parse::<usize>().unwrap()).sum();

    let total_people = friend_count + 1;
    let position = finger_count % total_people;

    let res = vec![1,2,3,4,5].iter().fold(0, |res, next| {
        if (next + position) % total_people == 0 {
            res
        } else {
            res + 1
        }
    });

    println!("{}", res);

}

fn get_input() -> String {
    let mut buffer = String::new();
    std::io::stdin().read_line(&mut buffer).expect("Failed");
    buffer.trim().to_owned()
}

fn get_input_usize() -> usize {
    get_input().parse().unwrap()
}


fn read_int() -> u16 {
    let mut input = String::new();
    std::io::stdin().read_line(&mut input).expect("Failed");
    let x = input.trim().parse::<u16>().unwrap();
    x
}

fn read_int_vec() -> Vec<u16>{
    let mut input = String::new();
    std::io::stdin().read_line(&mut input).expect("read error");
    let mut vec = input.split_whitespace()
        .map(|i| i.parse::<u16>().expect("parse error"))
        .collect::<Vec<u16>>();
    vec
}

fn main() {

    let x = read_int() + 1;
    let vec = read_int_vec();
    let sum: u16 = vec.iter().sum();

    if ((sum % x) + x) % x == 0 {
        println!("{}", 2);
    } else {
        println!("{}", 1);
    }
}


fn read_int() -> u16 {
    let mut input = String::new();
    std::io::stdin().read_line(&mut input).expect("Failed");
    let x = input.trim().parse::<u16>().unwrap();
    x
}

fn read_int_vec() -> Vec<u16>{
    let mut input = String::new();
    std::io::stdin().read_line(&mut input).expect("read error");
    let mut vec = input.split_whitespace()
        .map(|i| i.parse::<u16>().expect("parse error"))
        .collect::<Vec<u16>>();
    vec
}

fn main() {

    let x = read_int() + 1;
    let vec = read_int_vec();
    let sum: u16 = vec.iter().sum();

    let mut total = 0;
    let mut range = 1..6;
    loop {
        match range.next() {
            Some(i) => {
                // println!("also: ({}+{}) % {} = {}", sum, i, x, (((sum+i) % x) + x)% x);
                if !((((sum+i) % x) + x) % x == 1){
                    // println!("====");
                    total = total + 1;
                }
            },
            None => { break }
        }
    }
    println!("}", total);

}


//https://qiita.com/tanakh/items/0ba42c7ca36cd29d0ac8 より
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
    ($($r:tt)*) => {
        let s = {
            use std::io::Read;
            let mut s = String::new();
            std::io::stdin().read_to_string(&mut s).unwrap();
            s
        };
        let mut iter = s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
}

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

macro_rules! read_value {
    ($iter:expr, ( $($t:tt),* )) => {
        ( $(read_value!($iter, $t)),* )
    };
    ($iter:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($iter, $t)).collect::<Vec<_>>()
    };
    ($iter:expr, chars) => {
        read_value!($iter, String).chars().collect::<Vec<char>>()
    };
    ($iter:expr, bytes) => {
        read_value!($iter, String).bytes().collect::<Vec<u8>>()
    };
    ($iter:expr, usize1) => {
        read_value!($iter, usize) - 1
    };
    ($iter:expr, $t:ty) => {
        $iter.next().unwrap().parse::<$t>().expect("Parse error")
    };
}

//

// 異なる値が含まれるやつはどっちがどっちかわからないので不可能
// 同じ値のみを聞き出す戦略
// 同じ値のみを残せるように聞く戦略
// 同じ値を残せるように聞く戦略ができるならのみを聞き出すことも可能
//
// 同じ値のみを残す
// a をk 個聞き出せる条件は
// aを使わないで(k - i) * a を作れないこと
// 分割統治bitset?

use std::cmp::*;

fn run() {
    input! {
        n: usize,
        a: [usize; n],
    }
    let mut a = a.into_iter().map(|a| (a, 1)).collect::<Vec<_>>();
    a.sort();
    a.dedup_by(|a, b| {
        a.0 == b.0 && {
            b.1 += a.1;
            true
        }
    });
    let w = n * 100;
    let mut dp = vec![vec![0u8; w + 1]; n + 1];
    dp[0][0] = 1;
    for &(a, c) in a.iter() {
        for i in (1..=n).rev() {
            for j in a..=w {
                let mut v = dp[i][j];
                for k in 1..=min(j / a, min(i, c)) {
                    v = v.saturating_add(dp[i - k][j - k * a]);
                }
                dp[i][j] = v;
            }
        }
    }
    /*
    for i in 0..=n {
        for j in 0..=w {
            print!("{} ", dp[i][j]);
        }
        println!();
    }
    */
    let s = a.iter().fold(0, |s, a| s + a.0 * a.1);
    let mut ans = 1;
    for &(a, c) in a.iter() {
        for k in 2..=c {
            if dp[k][k * a] == 1 || dp[n - k][s - k * a] == 1 {
                ans = max(ans, k);
            }
        }
    }
    println!("{}", ans);
}

fn main() {
    run();
}


use std::io::{self, Stdin};
use std::str::{self, FromStr};
use std::error::Error;
use std::thread;

fn exec() {
    let mut sc = Scanner::new();
    let n: i64 = sc.ne();
    let ans = if is_prime(n) {
        1
    } else if n & 1 == 1 {
        3
    } else {
        2
    };
    println!("{}", ans);
}

fn is_prime(x: i64) -> bool {
    let mut y = 2;
    while y * y <= x {
        if x % y == 0 {
            return false;
        }
        y += 1;
    }
    x != 1
}
const DEFAULT_STACK: usize = 16 * 1024 * 1024;
fn main() {
    let builder = thread::Builder::new();
    let th = builder.stack_size(DEFAULT_STACK);
    let handle = th.spawn(|| { exec(); }).unwrap();
    let _ = handle.join();
}

#[allow(dead_code)]
struct Scanner {
    stdin: Stdin,
    id: usize,
    buf: Vec<u8>,
}

#[allow(dead_code)]
impl Scanner {
    fn new() -> Scanner {
        Scanner {
            stdin: io::stdin(),
            id: 0,
            buf: Vec::new(),
        }
    }
    fn next_line(&mut self) -> Option<String> {
        let mut res = String::new();
        match self.stdin.read_line(&mut res) {
            Ok(0) => return None,
            Ok(_) => Some(res),
            Err(why) => panic!("error in read_line: {}", why.description()),
        }
    }
    fn next<T: FromStr>(&mut self) -> Option<T> {
        while self.buf.len() == 0 {
            self.buf = match self.next_line() {
                Some(r) => {
                    self.id = 0;
                    r.trim().as_bytes().to_owned()
                }
                None => return None,
            };
        }
        let l = self.id;
        assert!(self.buf[l] != b' ');
        let n = self.buf.len();
        let mut r = l;
        while r < n && self.buf[r] != b' ' {
            r += 1;
        }
        let res = match str::from_utf8(&self.buf[l..r]).ok().unwrap().parse::<T>() {
            Ok(s) => Some(s),
            Err(_) => panic!("parse error"),
        };
        while r < n && self.buf[r] == b' ' {
            r += 1;
        }
        if r == n {
            self.buf.clear();
        } else {
            self.id = r;
        }
        res
    }
    fn ne<T: FromStr>(&mut self) -> T {
        self.next::<T>().unwrap()
    }
}