jiahuimbzuai/CoQuIR huggingface dataset:
//  [javascript]
var read = require('readline').createInterface({
  input: process.stdin,
  output: process.stdout
});
var obj;
var inLine = [];
read.on('line', function(input){inLine.push(input);});
read.on('close', function(){
  obj = init(inLine);
  myerr("-----start-----");
  var start = new Date();
  Main();
  var end = new Date() - start;
  myerr("----- end -----");
  myerr("time : " + (end) + "ms");
});
function nextInt(){return myconv(next(),1);} function nextStrArray(){return myconv(next(),2);}
function nextIntArray(){return myconv(next(),4);} function nextCharArray(){return myconv(next(),6);}
function next(){return obj.next();} function hasNext(){return obj.hasNext();}
function init(input){  
  var returnObj = {
    list : input, index : 0, max : input.length,
    hasNext : function(){return (this.index < this.max);},
    next : function(){if(!this.hasNext()){throw "ArrayIndexOutOfBoundsException これ以上ないよ";}else{var returnInput = this.list[this.index];this.index++;return returnInput;}}
  };
  return returnObj;
}
function myout(s){console.log(s);}
function myerr(s){console.error("debug:" + require("util").inspect(s,false,null));}
//[no]要素の扱い。数値型
//不明値、異常時:引数そのまま返す 1:数値へ変換
//2:半角SPで分割 4:半角SPで分割し、数値配列へ
//6:1文字で分割  7:1文字で分割し、数値配列へ
//8:半角SPで結合 9:改行で結合 0:文字なしで結合
function myconv(i,no){try{switch(no){case 1:return parseInt(i);case 2:return i.split(" ");case 4:return i.split(" ").map(Number);case 6:return i.split("");case 7:return i.split("").map(Number);case 8:return i.join(" ");case 9:return i.join("\n");case 0:return i.join("");default:return i;}}catch(e){return i;}}
function Main(){
	var N = nextInt();
	if(N == 1){
		myout(0);
		return;
	}
	var s = next();
	var siro = new Array(N).fill(0);
	var kuro = new Array(N).fill(0);
	var output = 10000000;
	for(var i = 0; i < N; i++){
		if(s[i] == "#"){
			kuro[i]++;
		}else{
			siro[i]++;
		}
	}
	for(var i = 1; i < N; i++){
		siro[i] += siro[i - 1];
		kuro[i] += kuro[i - 1];
	}
	var siroMax = siro[N - 1];
	if(siroMax == N || siroMax == 0){
		myout(0);
		return;
	}
	if(s[0] == "#"){
		output = siroMax;
	}
	for(var i = 1; i < N; i++){
		if(s[i - 1] == "." && s[i] == "#"){
			output = Math.min(output, kuro[i - 1] + (siroMax - siro[i - 1]));
		}
	}
	myout(output);

}
//  [javascript]
var read = require('readline').createInterface({
  input: process.stdin,
  output: process.stdout
});
var obj;
var inLine = [];
read.on('line', function(input){inLine.push(input);});
read.on('close', function(){
  obj = init(inLine);
  myerr("-----start-----");
  var start = new Date();
  Main();
  var end = new Date() - start;
  myerr("----- end -----");
  myerr("time : " + (end) + "ms");
});
function nextInt(){return myconv(next(),1);} function nextStrArray(){return myconv(next(),2);}
function nextIntArray(){return myconv(next(),4);} function nextCharArray(){return myconv(next(),6);}
function next(){return obj.next();} function hasNext(){return obj.hasNext();}
function init(input){  
  var returnObj = {
    list : input, index : 0, max : input.length,
    hasNext : function(){return (this.index < this.max);},
    next : function(){if(!this.hasNext()){throw "ArrayIndexOutOfBoundsException これ以上ないよ";}else{var returnInput = this.list[this.index];this.index++;return returnInput;}}
  };
  return returnObj;
}
function myout(s){console.log(s);}
function myerr(s){console.error("debug:" + require("util").inspect(s,false,null));}
//[no]要素の扱い。数値型
//不明値、異常時:引数そのまま返す 1:数値へ変換
//2:半角SPで分割 4:半角SPで分割し、数値配列へ
//6:1文字で分割  7:1文字で分割し、数値配列へ
//8:半角SPで結合 9:改行で結合 0:文字なしで結合
function myconv(i,no){try{switch(no){case 1:return parseInt(i);case 2:return i.split(" ");case 4:return i.split(" ").map(Number);case 6:return i.split("");case 7:return i.split("").map(Number);case 8:return i.join(" ");case 9:return i.join("\n");case 0:return i.join("");default:return i;}}catch(e){return i;}}
function Main(){
	var N = nextInt();
	var s = nextCharArray();
	while(s.length > 0 && s[s.length - 1] == "#"){
		s.pop();
	}
	while(s.length > 0 && s[0] == "."){
		s.shift();
	}
	var kuro = 0;
	var siro = 0;
	for(var i = 0; i < s.length; i++){
		if(s[i] == "#"){
			kuro++;
		}else{
			siro++;
		}
	}
	myout(Math.min(siro,kuro));
}
//  [javascript]
inp = require('fs').readFileSync('/dev/stdin', 'utf8').trim().split('\n')
N = inp.shift() * 1
s = inp.shift()
l = 0
r = s.length
while(s[l] == '.') {
    l++
}
while(s[r-1] == '#') {
    r--
}
c=0
for (i=l; i<r; i++) {
    if (s[i] == '#') {
        c++
    }
}
console.log(Math.min(c, r - l - c))
//  [go]
package main

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

var sc = bufio.NewScanner(os.Stdin)

func ini() {
	var buf = make([]byte, 10000)
	sc.Buffer(buf, 1000000)
}

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

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

func main() {
	ini()
	N, _ := strconv.Atoi(nextLine())
	S := nextLine()
	b := make([]int, N+1)

	for i, s := range S {
		if s == '#' {
			b[i+1] = b[i] + 1
		} else {
			b[i+1] = b[i]
		}
	}
	ans := N
	for i := 1; i < N+1; i++ {
		ans = min(ans, b[i]+N-i-b[N]+b[i-1])
	}
	fmt.Println(ans)
}
//  [go]
package main

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

var sc = bufio.NewScanner(os.Stdin)

func ri() (n int) {
	sc.Scan()
	for _, v := range sc.Bytes() {
		n = n*10 + int(v-48)
	}
	return
}

func rb() []byte {
	sc.Scan()
	return sc.Bytes()
}

func smaller(a, b int) int {
	if a < b {
		return a
	}
	return b
}

func main() {
	sc.Split(bufio.ScanWords)
	sc.Buffer(make([]byte, 1e6), 1e6)
	n, s := ri(), rb()

	ctHash := 0
	for _, ss := range s {
		if ss == '#' {
			ctHash++
		}
	}
	ctDot := n - ctHash

	minCost := smaller(ctHash, ctDot)
	ctHash = 0
	for _, ss := range s {
		switch ss {
		case '#':
			ctHash++
		case '.':
			ctDot--
		}
		if cost := ctHash + ctDot; cost < minCost {
			minCost = cost
		}
	}
	fmt.Println(minCost)
}
//  [go]
package main

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

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

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

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

	n := nextInt()
	s := next()

	ans := n
	w := 0
	b := 0
	cw := true

	for i := 0; i < n; i++ {
		if s[i] == '.' {
			w++
		}
	}

	if w == 0 {
		fmt.Fprintln(out, 0)
		return
	}

	for i := 0; i < n; i++ {
		if (cw && s[i] == '#') || ((!cw) && s[i] == '.') {
			if cw {
				ans = minInt(ans, b+w)
			}
			cw = !cw
		}

		if s[i] == '#' {
			b++
		} else {
			w--
		}
	}

	ans = minInt(ans, b+w)

	//99999

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

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

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

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

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

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

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

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

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

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

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

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

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

	n := nextInt()
	s := next()

	ans := n
	w := 0
	b := 0
	cw := s[0] == '.'

	for i := 0; i < n; i++ {
		if s[i] == '.' {
			w++
		}
	}

	if w == 0 {
		fmt.Fprintln(out, 0)
		return
	}

	for i := 0; i < n; i++ {
		if (cw && s[i] == '#') || ((!cw) && s[i] == '.') {
			if cw {
				ans = minInt(ans, b+w)
			}
			cw = !cw
		}

		if s[i] == '#' {
			b++
		} else {
			w--
		}
	}

	ans = minInt(ans, b+w)

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

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

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

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

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

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

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

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

func absInt(x int) int {
	return int(math.Abs(float64(x)))
}
func minInt(x, y int) int {
	if x < y {
		return x
	}
	return y
}
func maxInt(x, y int) int {
	if x > y {
		return x
	}
	return y
}
func log10(x int) float64 {
	return math.Log10(float64(x))
}
//  [ruby]
n = gets.chomp.to_i
s = gets.chomp
countb = 0
countw = 0
abs = 0
pos = n - 1

while pos >= 0
  if s[pos] == '.' then
    break
  end
  pos -= 1
end

while pos >= 0
  if s[pos] == '.' then
    countw += 1
  else
    countb += 1
  end

  if countw < countb then
    abs += countw
    countb = 0
    countw = 0
  end
  pos -= 1
end

puts abs + [countw, countb].min
//  [ruby]
n = gets.chomp.to_i
s = gets.chomp

pos = n - 1
while pos >= 0
  if s[pos] == '#'
    pos -= 1
    next
  end
  break
end

black_cnt = 0
white_cnt = 0
ans = 0
while pos >= 0
  if s[pos] == '#'
    black_cnt += 1
  else
    white_cnt += 1
  end
  if black_cnt > white_cnt
    ans += white_cnt
    black_cnt = 0
    white_cnt = 0
  end
  pos -= 1
end
puts ans + [black_cnt, white_cnt].min
//  [ruby]
n = gets.chomp.to_i
s = gets.chomp
countb = 0
countw = 0
countm = 0
abs = 0
pos = n - 1

while pos >= 0
  if s[pos] == '.' then
    break
  end
  pos -= 1
end

while pos >= 0
  if s[pos] == '.' then
    countm += 1
    countw += 1
  else
    countb += 1
  end

  if countm < countb then
    abs += countw
    countb = 0
    countw = 0
    countm = 0
  end
  pos -= 1
end

puts abs + [countw, countb].min
//  [ruby]
n = gets.to_i
s = gets.chomp
j = n - 2

res = 0
while j >= 0
  if s[j] == "#" && s[j + 1] == "."
    res += 1
  end
  j -= 1
end
puts res
//  [ruby]
n = gets.to_i
s = gets.chomp
i = 0
j = n - 1

res = 0
while i < j
  while s[i] == "." && i < j
    i += 1
  end
  while s[j] == "#" && i < j
    j -= 1
  end

  if i < j && s[i] == "#"
    res += 1
    i += 1
  end
  if i < j && s[j] == "."
    res += 1
    j -= 1
  end
end
puts res
//  [ruby]
n = gets.to_i
s = gets.chomp
blacks = s.split(".").map { |c| c.size }.reject { |n| n.zero? }
whites = s.split("#").map { |c| c.size }.reject { |n| n.zero? }
min_black_change = blacks.inject(0) { |res, num| res + num }
min_black_change -= blacks[-1] if min_black_change > 0 && s[-1] == "#"
min_white_change = whites.inject(0) { |res, num| res + num }
min_white_change -= whites[0] if min_white_change > 0 && s[0] == "."
puts [min_black_change, min_white_change].min
//  [rust]
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")
    };
}
use std::cmp;
fn main() {
    input! {
        n: usize,
        s: chars, 
    }
    let mut black_cnt = 0;
    let mut white_cnt = 0;
    for c in &s {
        if *c == '#' {
            black_cnt += 1;
        } else {
            white_cnt += 1;
        }
    }
    let mut fwd_b = 0;
    let mut bwd_w = white_cnt;
    let mut ans = cmp::min(black_cnt, white_cnt);

    for c in &s {
        if *c == '#' {
            fwd_b += 1;
        } else {
            bwd_w -= 1;
        }
        ans = cmp::min(ans, fwd_b + bwd_w);
    }
    println!("{}", ans);
 }
//  [rust]
#[allow(unused_macros)]
macro_rules! p {
    ($x:expr $(, $tail:expr)*) => {
        let mut s = String::new();
        s.push_str(format!("{:?}", $x).as_str());
        $(
            s.push_str(format!(", {:?}", $tail).as_str());
        )*
        println!("{}", s);
    };
}

#[allow(unused_macros)]
macro_rules! pl {
    ($($x:expr), *) => {
        $(println!("{:?}", $x);)*
    };
}

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! stdin {
    () => {{
        use std::io::Read;
        let mut s = String::new();
        std::io::stdin().read_to_string(&mut s).unwrap();
        s
    }};
}

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 main() {
    println!("{}", solve(stdin!()));
}

fn solve(src: String) -> String {
    input! {
        source = src,
        n: usize,
        s: chars,
    }
    let mut white = 0;
    for i in 0..n {
        if s[i] == '.' {
            white += 1;
        }
    }
    let mut left_black = 0;
    let mut right_white = white;
    let mut ans = right_white;
    for i in 0..n {
        if s[i] == '#' {
            left_black += 1;
        } else if s[i] == '.' {
            right_white -= 1;
        }
        ans = std::cmp::min(ans, left_black + right_white);
    }
    ans.to_string()
}

// Test Code

macro_rules! test {
    ($($input:expr => $output:expr),* $(,)*) => {
        #[test]
        fn solve_test() {
            $(
                assert_eq!(solve($input.to_string()), $output);
            )*
        }
    };
}

test! {
r"
3
#.#
" => "1",

r"
5
#.##.
" => "2",

r"
9
.........
" => "0",

r"
9
##...#.#.
" => "4",
}
//  [rust]
#[allow(unused_imports)]
use std::cmp::{Ordering};

#[allow(unused_imports)]
use std::collections::{BTreeMap, BTreeSet, BinaryHeap, HashMap, HashSet, VecDeque};

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

#[allow(unused_imports)]
use std::iter::FromIterator;

#[allow(unused_macros)]
macro_rules! min {
    ($x: expr) => ($x);
    ($x: expr, $($z: expr),+) => {{
        std::cmp::min($x, min!($($z),*))
    }}
}

#[allow(unused_macros)]
macro_rules! max {
    ($x: expr) => ($x);
    ($x: expr, $($z: expr),+) => {{
        std::cmp::max($x, max!($($z),*))
    }}
}

#[allow(unused_macros)]
macro_rules! get { 
    ([$t: ty]) => { 
        { 
            let mut line = String::new(); 
            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<_>>()
    };
    ($t: ty) => {
        {
            let mut line = String::new();
            stdin().read_line(&mut line).unwrap();
            line.trim().parse::<$t>().unwrap()
        }
    };
    ($($t: ty),*) => {
        { 
            let mut line = String::new();
            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<_>>()
    };
}

#[allow(unused_macros)]
macro_rules! debug {
    ($($a:expr),*) => {
        #[cfg(debug_assertions)]
        writeln!(&mut std::io::stderr(), concat!("[DEBUG] ", $(stringify!($a), "={:?} "),*), $($a),*).unwrap();
    }
}

const BIG_STACK_SIZE: bool = true;

#[allow(dead_code)]
fn main() {
    use std::thread;
    if BIG_STACK_SIZE {
        thread::Builder::new()
            .stack_size(32 * 1024 * 1024)
            .name("solve".into())
            .spawn(solve)
            .unwrap()
            .join()
            .unwrap();
    } else {
        solve();
    }
}

fn solve() {
    let n = get!(usize);
    let s = get!(String).chars().collect::<Vec<_>>();

    let mut whites = vec![0; n+1];
    for i in 0..n {
        whites[i+1] = if s[i] == '.' {
            whites[i] + 1
        } else {
            whites[i]
        };
    }

    let  mut mn = std::usize::MAX;
    for i in 0..(n+1) {
        mn = min!(mn, (i-whites[i]) + (whites[n]-whites[i]));
    }
    println!("{}", mn);
}
//  [rust]
use proconio::{input, marker::Chars};

fn main() {
    input! {
        n: usize,
        s: Chars,
    }

    let mut count_white = 0;
    for &c in s.iter() {
        if c == '.' {
            count_white += 1;
        }
    }

    let mut count_black = 0;
    let mut ans = n;

    for c in s {
        match c {
            '.' => count_white -= 1,
            '#' => count_black += 1,
            _ => {}
        }
        ans = std::cmp::min(ans, count_black + count_white);
    }

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

fn main() {
    input! {
        n: usize,
        s: Chars,
    }

    let mut count_white = vec![];
    let mut count_black = vec![];
    for &c in s.iter() {
        let a = if c == '#' { 1 } else { 0 };
        if let Some(&last) = count_black.last() {
            count_black.push(last + a);
        } else {
            count_black.push(a);
        }
    }
    for &c in s.iter() {
        let a = if c == '.' { 1 } else { 0 };
        if let Some(&last) = count_white.last() {
            count_white.push(last + a);
        } else {
            count_white.push(a);
        }
    }
    count_white.reverse();

    let mut ans = n;
    for i in 0..=n {
        let mut temp = 0;
        if i > 0 {
            temp += count_black[i - 1];
        }
        if i < n {
            temp += count_white[i];
        }

        ans = std::cmp::min(ans, temp);
    }

    println!("{}", ans);
}
//  [rust]
// -*- coding:utf-8-unix -*-

use std::cmp::*;
use std::collections::*;
use std::fs::File;
use std::io::prelude::*;
use std::io::*;
use std::vec;

const INF: i64 = 1223372036854775807;
const MEM_SIZE: usize = 202020;

use std::cmp::*;
use std::collections::*;
use std::io::stdin;
use std::io::stdout;
use std::io::Write;
#[allow(dead_code)]
fn read<T: std::str::FromStr>() -> T {
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).ok();
    s.trim().parse().ok().unwrap()
}
#[allow(dead_code)]
fn read_vec<T: std::str::FromStr>() -> Vec<T> {
    read::<String>()
        .split_whitespace()
        .map(|e| e.parse().ok().unwrap())
        .collect()
}
#[allow(dead_code)]
fn read_vec2<T: std::str::FromStr>(n: u32) -> Vec<Vec<T>> {
    (0..n).map(|_| read_vec()).collect()
}

#[allow(unused_macros)]
macro_rules! p {
    ([$($x:expr), *]) => {{
        let mut f = true;
        $(
            print!("{}{}", if f {""} else {" "}, $x);
            f = false;
        )*
78786    print!("\n");
    }};
    ($x:expr) => {{
        let mut f = true;
        for a in $x.iter() {
            print!("{}{}", if f {""} else {" "}, a);
            f = false;
        }
        print!("\n");
    }};
}
#[allow(dead_code)]
fn readii() -> (i64, i64) {
    let mut str = String::new();
    let _ = stdin().read_line(&mut str).unwrap();
    let mut iter = str.split_whitespace();
    (
        iter.next().unwrap().parse::<i64>().unwrap(),
        iter.next().unwrap().parse::<i64>().unwrap(),
    )
}
#[allow(dead_code)]
fn readuu() -> (usize, usize) {
    let mut str = String::new();
    let _ = stdin().read_line(&mut str).unwrap();
    let mut iter = str.split_whitespace();
    (
        iter.next().unwrap().parse::<usize>().unwrap(),
        iter.next().unwrap().parse::<usize>().unwrap(),
    )
}

#[allow(dead_code)]
fn vector_accumulation(vec: &Vec<i64>) -> Vec<i64> {
    let mut res = Vec::new();
    let size = vec.len();
    res.push(0);
    for i in 0..size {
        res.push(vec[i]);
    }
    for i in 0..size {
        res[i + 1] += res[i];
    }
    res
}

fn solve() {
    let n: usize = read();
    let s: String = read();
    let mut v = s.as_bytes().to_vec();
    let mut vec: Vec<i64> = vec![0; n];
    for i in 0..n {
        if v[i] == '#' as u8 {
            vec[i] = 1;
        }
    }

    let avec = vector_accumulation(&vec);
    let mut res = INF;
    for i in 0..(n + 1) {
        let b = avec[i];
        let w = n as i64 - avec[i];
        res = min(res, ((n - i) as i64 - b).abs() + ((n) as i64 - w).abs());
    }
    println!("{}", res);

    return;
}
fn main() {
    solve()
}
//  [swift]
readLine()
let S=readLine()!.characters.map{$0>"#" ?1:0}
var i=S.reduce(0){$0+$1}
print(S.reduce(i){min($0,$1>0 ? --i:++i)})
//  [swift]
let N = Int(readLine()!)!
let S = readLine()!.characters.map{$0>"#" ?1:-1}
var cnt = S.filter{$0>0}.count
var ans = cnt
for i in S {
    cnt -= i
    ans = min(cnt, ans)
}
print(ans)
//  [swift]
let N = Int(readLine()!)!
let S = readLine()!.characters.map{$0>"#" ?1:0}
var cnt = S.reduce(0){$0+$1}
print(S.reduce(cnt){min($1>0 ? --cnt:++cnt, $0)})
//  [swift]
let num = Int(readLine()!)
let str = readLine()!

var prevs: String = ""
var bcount: Int = 0
var wcount: Int = 0
var count = 1

for s in str.characters {
    if( ( String(s) == "." ) ) {
      wcount += 1
    }
  
  	if( String(s) == "#" ) && ( count != num )  {
      bcount += 1
    }
  
  	prevs = String(s)
  	count += 1
}

if( bcount < wcount ) {
  print( bcount  )
} else {
  print( wcount  )
}
//  [swift]
let num = Int(readLine()!)
let str = readLine()!

var prevs: String = ""
var bcount: Int = 0
var wcount: Int = 0

for s in str.characters {
    if( ( String(s) == "." ) && ( prevs == "#" ) ) {
      bcount += 1
    }
  
  	if( String(s) == "." ) {
      wcount += 1
    }
  
  	prevs = String(s)
}

if( bcount < wcount ) {
  print( bcount )
} else {
  print( wcount )
}
//  [swift]
let num = Int(readLine()!)
let str = readLine()!

var prevs: String = ""
var bcount: Int = 0
var wcount: Int = 0

for s in str.characters {
    if( ( String(s) == "#" ) && prevs = "." ) {
      bcount += 1
    }
  
  	if( String(s) == "." ) {
      wcount += 1
    }
  
  	prevs = String(s)
}

if( bcount < wcount ) {
  print( bcount )
} else {
  print( wcount )
}
//  [typescript]


const solve = (s) => {
  let w = []
  let wc = 0
  let b = []
  let bc = 0
  s.split("").map((c, i) => {
    if (c == ".") {
      wc++
    } else {
      bc++
    }
    w[i] = wc
    b[i] = bc
  })
  let r = []
  let res = s.length
  for (var i = 0; i < w.length; i++) {
    let bb = b[i - 1] || 0
    let ww = w[w.length - 1] - w[i]
    let rr = bb + ww
    res = Math.min(res, rr)
  }
  return res
}
const main = (input) => {
  const [n, s] = input.split("\n")
  return solve(s)
}

if (process.env.NODE_ENV !== "test") {
  const input = require("fs").readFileSync("/dev/stdin", "utf8")
  console.log(main(input.trim()))
}
//  [typescript]
const fs = require('fs')
const stdin = fs.readFileSync('/dev/stdin', 'utf8')

const N = Number(stdin.split('\n')[0])
const s = stdin.split('\n')[1]

const S = s.split('')

let leftBlack = 0
let rightWhite = S.reduce((p, c) => {
  return p += c === '.' ? 1 : 0
}, 0)

let min = Math.min(rightWhite, N - rightWhite)
S.forEach(v => {
  leftBlack += v === '#' ? 1 : 0 
  rightWhite -= v === '.' ? 1 : 0
  
  const sum = leftBlack + rightWhite

  min = sum < min ? sum : min
})

console.log(min)
//  [typescript]
const p = (...args) => {
  process.env.NODE_ENV === "test" ? console.log(...args) : ""
}

const solve1 = (s) => {
  let b = false
  let cnt = 0
  s.split("").map((c) => {
    if (c == "#" && !b) {
      b = true
    }
    if (c == "." && b) {
      cnt++
    }
  })
  return cnt
}
const solve2 = (s) => {
  let b = false
  let cnt = 0
  s.split("")
    .reverse()
    .map((c) => {
      if (c == "." && !b) {
        b = true
      }
      if (c == "#" && b) {
        cnt++
      }
    })
  return cnt
}

const main = (input) => {
  const [n, s] = input.split("\n")

  return Math.min(solve1(s || ""), solve2(s || ""))
}

if (process.env.NODE_ENV !== "test") {
  const input = require("fs").readFileSync("/dev/stdin", "utf8")
  console.log(main(input.trim()))
}
//  [typescript]
const p = (...args) => {
  process.env.NODE_ENV === "test" ? console.log(...args) : ""
}

const solve = (s) => {
  let b = false
  let cnt = 0
  s.split("").map((c) => {
    if (c == "#" && !b) {
      b = true
    }
    if (c == "." && b) {
      cnt++
    }
  })
  return cnt
}
const main = (input) => {
  const [n, s] = input.split("\n")

  return solve(s || "")
}

if (process.env.NODE_ENV !== "test") {
  const input = require("fs").readFileSync("/dev/stdin", "utf8")
  console.log(main(input.trim()))
}
//  [typescript]

const solve = (s) => {
  let b = false
  let cnt = 0
  s.split("").map((c) => {
    if (c == "#" && !b) {
      b = true
    }
    if (c == "." && b) {
      cnt++
    }
  })
  return cnt
}
const main = (input) => {
  const [n, s] = input.split("\n")

  return solve(s)
}

if (process.env.NODE_ENV !== "test") {
  const input = require("fs").readFileSync("/dev/stdin", "utf8")
  console.log(main(input.trim()))
}
//  [python]
h, a = map(int,input().split())

if h % a == 0:
    print(h//a)
else:
    print(h//a + 1)
//  [python]
H, A = map(int, input().split())
if H % A == 0:
  ans = H // A
else:
  ans = H // A + 1
print(ans)
//  [python]
import sys
 
for line in sys.stdin:
    h, a = list(map(lambda x: int(x), line.split()))
    hits = h // a
    if h % a == 0 and a > 0:
        print(hits)
    else:
    	print(hits + 1)
//  [python]
h, a = map(int, input().split())

print(h//a + 1)
//  [python]
H,N=map(int,input().split())

ans=(H+N)//N
print(ans)
//  [python]
h,a = map(int,input().split())

if h % a == 0:
  print(h / a)
else :
  print(h // a + 1)
//  [java]
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class Main {
	
	public static void main(String args[]) throws IOException {
		
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		
		String parts[] = br.readLine().split(" ");
		
		int H = Integer.parseInt(parts[0]);
		int A = Integer.parseInt(parts[1]);
		
		int a = H%A;
		
		if(a==0) {
			System.out.println(H/A);
		}else {
			System.out.println(H/A+1);
		}
		
	}

}
//  [java]
/*
    Those who cannot remember the past are condemned to repeat it.
                                            - Dynamic Programming
    
    I never lose, I either win or I learn.
                - Competitive Programming

*/

import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.StringTokenizer;

public class Main {
    public static void main(String[] args) throws Exception {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        StringTokenizer st;
        PrintWriter pw = new PrintWriter(System.out);

        st = new StringTokenizer(br.readLine());
        int n = Integer.parseInt(st.nextToken());
        int k = Integer.parseInt(st.nextToken());
        int ans = 0;
        if(n%k == 0) {
            ans = n/k;
        }
        else {
            ans = n/k+1;
        }

        pw.println(ans);
        

        pw.flush();
        pw.close();
    }
}
//  [java]
import java.io.*;
import java.util.*;
import static java.lang.System.*;
import static java.lang.Math.*;

public class Main
{
	public static void main(String []args)throws IOException
	{
		BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
		String []s=br.readLine().split(" ");
		int H = Integer.parseInt(s[0]);
		int A = Integer.parseInt(s[1]);
		
		if(H%A!=0)
			out.println((H/A)+1);
		else
			out.println((H/A));
	
	}
}
//  [java]

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.util.*;


public class Main {

    public static void main(String[] args) throws IOException {
        Scanner s = new Scanner(System.in);
        int h = s.nextInt(),a = s.nextInt();
        System.out.println((int)(Math.ceil(h/a)));
        
    }
}




class Scanner
{
    StringTokenizer st;
    BufferedReader br;

    public Scanner(InputStream s){	br = new BufferedReader(new InputStreamReader(s));}

    public String next() throws IOException
    {
        while (st == null || !st.hasMoreTokens())
            st = new StringTokenizer(br.readLine());
        return st.nextToken();
    }

    public int nextInt() throws IOException {return Integer.parseInt(next());}

    public long nextLong() throws IOException {return Long.parseLong(next());}

    public String nextLine() throws IOException {return br.readLine();}

    public double nextDouble() throws IOException
    {
        String x = next();
        StringBuilder sb = new StringBuilder("0");
        double res = 0, f = 1;
        boolean dec = false, neg = false;
        int start = 0;
        if(x.charAt(0) == '-')
        {
            neg = true;
            start++;
        }
        for(int i = start; i < x.length(); i++)
            if(x.charAt(i) == '.')
            {
                res = Long.parseLong(sb.toString());
                sb = new StringBuilder("0");
                dec = true;
            }
            else
            {
                sb.append(x.charAt(i));
                if(dec)
                    f *= 10;
            }
        res += Long.parseLong(sb.toString()) / f;
        return res * (neg?-1:1);
    }

    public boolean ready() throws IOException {return br.ready();}


}
//  [java]
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		// TODO Auto-generated method stub
Scanner SC = new Scanner(System.in);
int H = SC.nextInt();
int A = SC.nextInt();
System.out.println(H + A - 1/A);
	}

}
//  [java]
/*
 * Click `Run` to execute the snippet below!
 */

import java.io.*;
import java.util.*;

/*
 * To execute Java, please define "static void main" on a class
 * named Solution.
 *
 * If you need more classes, simply define them inline.
 */

public class Main {
  
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    int H = sc.nextInt();
    int A = sc.nextInt();
    System.out.println(Math.ceil(1.0 * H / A));
  }
}
//  [cpp]
#include<stdio.h>
int main(){
    int h;
    int a;
    scanf("%d",&h);
    scanf("%d",&a);
    if(h%a==0){
        printf("%d",h/a);
    }else{
        printf("%d",h/a+1);
    }
    return 0;
}
//  [cpp]
#include <stdio.h>

int h,a;

int main()
{
    scanf("%d%d",&h,&a);
    printf("%d\n",h%a==0?h/a:h/a+1);
}
//  [cpp]
#include <stdio.h>
int main(){
  int H,A,num;
  num = 0;
  scanf("%d",&H);
  scanf("%d",&A);
  while(0<H){
  num++;
  H-=A;
  }
  printf("%d",num);
 	return 0;
}
//  [cpp]
#include <iostream>
using namespace std;

int main() {
    int H, A,i;
    cin>>H>>A;
    while (H>0){
    H-=A;
    i++;
    }
    cout<<i;

    return 0;
    }
//  [cpp]
#include <bits/stdc++.h>
#define inf 1000000005
#define mod 1000000007
#define eps 1e-10
#define rep(i,n) for(int i = 0; i < (n); ++i) 
#define rrep(i,n) for(int i = 1; i <= (n); ++i) 
#define drep(i,n) for(int i = (n)-1; i >= 0; --i)
#define srep(i,s,t) for (int i = s; i < t; ++i)
#define each(a,b) for(auto& (a): (b)) 
#define all(v) (v).begin(),(v).end() 
#define sz(v) (int)(v).size() 
#define zip(v) sort(all(v)),v.erase(unique(all(v)),v.end())
#define mx(x,y) x=max(x,y) 
#define mn(x,y) x=min(x,y)
#define rev(v) reverse((v).begin(),(v).end());
#define so(v) sort((v).begin(), (v).end());
#define yn {puts("Yes");}else{puts("No");}
#define fi first
#define se second
#define pb push_back

using namespace std;

using ll = long long;
using P = pair<int,int>;
using pll = pair<ll, ll>;
using vi = vector<int>;
using vvi = vector<vi>;
using vl = vector<ll>;
using vvl = vector<vl>;
using vd = vector<double>;
using vp = vector<P>;
using vs = vector<string>; 

int main() {
    int a, b, ct,ans;
    string s;
 	 cin>>s;
    int r;
    a = sz(s);
    b = 0; 
    ct = 0;
    rep(i, a) {
        if (s.at(i) == 'W') {
            ct = ct + i + 1-1-b;
            b++;
        }
    }
    cout<<ct<<endl;
    return 0;
}
//  [cpp]
#include <stdio.h>
 int main (){
 	
	int A, B, H;
	
	scanf("%d %d", &A, &B);
	
	while (A>0){
		A= A - B;
		H++;
	}
	printf("%d\n", H):
 	return 0;
 }
//  [c]
#include <stdio.h>

int main()
{
    int h,a = 0;

    scanf("%d %d",&h,&a);

    if (h - a*(h/a) == 0) printf("%d",h/a);
    else printf("%d",h/a+1);

    return 0;
}
//  [c]
#include<stdio.h>

int main(void){
 	int H,A;

	scanf("%d %d",&H,&A);

 	int i=0;

  	while(H>0){
		    H=H-A;
      	i++;
    }

    printf("%d",i);

  	return 0;
}
//  [c]
#include<stdio.h>
int main(){
  int i,j;//i:モンスターの体力　j:攻撃一回につき減らせる体力
  scanf("%d %d",&i,&j);
  int n=i;
  int t=0;
  while(n>0){
    n-=j;
    t++;
  }
  printf("%d\n",t);
  return 0;
}
//  [c]
#include <stdio.h>

int main(void)
{
    int h=0,a=0,count=0;
    scanf("%d %d",&h,&a);

    while(h<=0){
        h-=a;
        count+=1;
    }
    printf("%d",count);
    return 0;
}
//  [c]
#include <stdio.h> 

int main()
{
  int H,A;
  scanf("%d %d", &H, &A);
  int c=a/b;
  if (H%A != 0){
  	c++;
  }
  
  	printf ("%d\n",c);
  	return 0;
  }
//  [c]
#include <stdio.h> 

int main()
{
  int H,A;
  scanf("%d %d", &H, &A);
  if (H%A == 0){
  	printf("%d\n",H/A);
  }
  else 
  	printf ("%d\n",(H/A)+1);
  }
  return 0;
}
//  [javascript]
function main(input) {
    const args = input.split(' ');
    const h = parseInt(args[0]);
    const a = parseInt(args[1]);

	console.log(Math.ceil(h/a));
}

main(require('fs').readFileSync('/dev/stdin', 'utf8'));
//  [javascript]
"use strict";
// inputに入力データ全体が入る
function Main(input) {
  // 1行目がinput[0], 2行目がinput[1], …に入る
  input = input.split("\n");
  let tmp = input[0].split(" ");
  //文字列から10進数に変換するときはparseIntを使います
  let h = parseInt(tmp[0], 10);
  let a = parseInt(tmp[1], 10);
  //出力
  console.log("%d", Math.ceil((1.0 * h) / a));
}
//*この行以降は編集しないでください（標準入出力から一度に読み込み、Mainを呼び出します）
Main(require("fs").readFileSync("/dev/stdin", "utf8"));
//  [javascript]
function main(input) {
    input = input.split(" ");
    var h = parseInt(input[0], 10);
    var a = parseInt(input[1], 10);

    console.log(Math.ceil(a/b));
}

main(require("fs").readFileSync("/dev/stdin", "utf8"));
//  [javascript]
function main(input) {
    input = input().split(" ");
    var h = parseInt(input[0], 10);
    var a = parseInt(input[1], 10);

    console.log(Math.ceil(a/b));
}

main(require("fs").readFileSync("/dev/stdin", "utf8"));
//  [javascript]
function main(input) {
    var input = input().split(" ");
    var h = parseInt(input[0], 10);
    var a = parseInt(input[1], 10);

    console.log(Math.ceil(a/b));
}

main(require("fs").readFileSync("/dev/stdin", "utf8"));
//  [go]
package main
import (
	"bufio"
	"fmt"
	"os"
	"strconv"
)
func newScanner() *bufio.Scanner{
	scanner := bufio.NewScanner(os.Stdin)
	scanner.Split(bufio.ScanWords)
	return scanner
}

var sc = newScanner()

func scanInt() int{
	sc.Scan()
	v, _ := strconv.Atoi(sc.Text())
	return v
}

func scanInts(n int) []int{
	a := make([]int, n)
	for i := 0; i < n; i++ {
		a[i] = scanInt()
	}
	return a
}

func scanString() string{
	if sc.Scan() {
		return sc.Text()
	}
	panic(sc.Err())
}

func main() {
	n := scanInt()
	h := scanInt()
	answer := countAttacks(n, h)
	fmt.Println(answer)
}

func countAttacks(n, h int) int {
	if n % h == 0 {
		return n / h
	}
	return n / h + 1
}
//  [go]
package main

import "fmt"

func main(){
	var H, A, ans int;
	fmt.Scan(&H, &A);

	for i := H ; i > 0 ; i-=A {
		ans++;
	}

	fmt.Println(ans);
}
//  [go]
package main

import (
	"fmt"
)

func main() {
	var h, a int
	fmt.Scan(&h, &a)
	at := h / a
	if h%a != 0 {
		at++
	}
	fmt.Println(at)
}
//  [go]
package main

import (
	"fmt"
)

func main() {
	var h, a int
	fmt.Scanf(&h, &a)
	fmt.Println((h + a - 1) / a)
}
//  [go]
package main

import (
	"fmt"
)

func main() {
	var h, a int
	fmt.Scan(&h, &a)

	if h%a == 0 {
		fmt.Println(h/a + 1)
	} else {
		fmt.Println(h / a)
	}
}
//  [go]
package main

import (
	"fmt"
)

func main() {
  var h, a int
  fmt.Scanf("%d %d", &h, &a)
  ans := (h / a) + 1
  
  fmt.Printf("%d\n", ans)
}
//  [ruby]
h, a = gets.split.map(&:to_i)

n = (h/a.to_f).ceil
puts n
//  [ruby]
# H A

h, a = gets.chomp.split(" ").map(&:to_i)

c = h / a

if h % a == 0
else
  c = c + 1
end

puts c
//  [ruby]
H, A = gets.chomp.split.map(&:to_i)
puts (H / A.to_f).ceil
//  [ruby]
h, a = gets.split.map(&:to_i)

puts h/a + 1
//  [ruby]
h,a = gets.chomp.split(" ").map(&:to_i)

h/a == 0 ? h/a : h/a+1
//  [ruby]
h,a = gets.chomp.split(" ").map(&:to_i)

h/a == 0 ? a/b : a/b+1
//  [rust]
use proconio::input;

fn main() {
    input! {
    h: u32,
    a: u32,
    }

    println!("{}", (h + a - 1) / a);
}
//  [rust]
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)*}
    };
}

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")
    };
}

fn main(){

    input!{
        h: usize,
        a: usize,
    }

    if h%a==0{
        println!("{}", h/a);
    } else {
        println!("{}", h/a+1);
    }

}
//  [rust]
use std::io::*;
use std::str::FromStr;

fn main() {
	let (h, a): (f32, f32) = (read(), read());
	let ans = (h / a).ceil() as u32;
	println!("{}", ans);
}

fn read<T: FromStr>() -> T {
	let stdin = stdin();
	let stdin = stdin.lock();
	let token: String = stdin
		.bytes()
		.map(|c| c.expect("failed to read char") as char)
		.skip_while(|c| c.is_whitespace())
		.take_while(|c| !c.is_whitespace())
		.collect();
	token.parse().ok().expect("failed to parse token")
}
//  [rust]
// unihernandez22
// https://atcoder.jp/contests/abc153/tasks/abc153_a
// math

use std::io::stdin;

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

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

    let h = words[0];
    let a = words[0];

    println!("{}", (h + a-1) / a);
}
//  [rust]
use proconio::input;
#[allow(unused_imports)]
use proconio::marker::*;

fn main() {
    input! {
        h : i32, a : i32,
    }
    println!("{}", kyopro_lib::misc::ceil(h, a));
}
//  [rust]

use std::io::*;
use std::str::FromStr;

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

pub fn read_n<T: FromStr>(n: usize) -> Vec<T> {
    read_n_logic::<T>(n, vec![])
}

pub fn read_n_logic<T: FromStr>(n: usize, mut a: Vec<T>) -> Vec<T> {
    match n {
        0 => a,
        _ => {
            a.push(read::<T>());
            read_n_logic(n - 1, a)
        }
    }
}
use std::cmp::{max, min};

fn main() {
    let n: i64 = read();
    let m: i64 = read();
    println!("{}", n / m +1);
}
//  [swift]
extension String:CollectionType{}
func readInts()->[Int]{
  return readLine()!.split(" ").map{Int($0)!}
}
let a:[Int]=readInts()
let n=a[0]
let m=a[1]
let ans=(n+m-1)/m
print(ans)
//  [swift]
let arr = readLine()!.characters.split{$0==" "}.map{Int(String($0))}
let h = arr[0]!
let a = arr[1]!
let amari = ( h % a ) > 0 ? 1 : 0
print(h / a + amari)
//  [swift]
func readInts() -> [Int] {
    return readLine()!.split(separator: " ").map { Int($0)! }
}

func main() {
    let ha = readInts()
    let h = ha[0]
    let a = ha[1]
    
    if h % a == 0 {
        print(h / a)
    } else {
        print(h / a + 1)
    }
}

main()
//  [swift]
let input = readLine()!.split(separator: " ").map { Int($0)! }
let H = input[0]
let A = input[1]

var times = H / A
if H - H / A > 0 {
  times += 1
}
print(times)
//  [swift]
let a = readLine()!.split(separator: " ").map({Int($0)})

let H = a[0]!
let A = a[1]!

var count = 1
while H >= A * count {
    count += 1
}
print(count)
//  [swift]
 if let  str = readLine() {
    let arr = str.split(separator: " ").map { Int($0)}
    if let H = arr[0], let A = arr[1] {
        print(H % A == 0 ? (H / A) : (H / A + 1))
    }
 }
//  [typescript]
import * as fs from "fs";

const input = (fs.readFileSync("/dev/stdin", "utf8") as string).split("\n");

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

const [h, a] = input[0].split(' ').map((x: string): number => +x);

if(h % a === 0){
	console.log(Math.floor(h/a));
}else{
	console.log(Math.floor(h/a) + 1);
}
//  [typescript]
import { readFileSync } from "fs";
const input = readFileSync("/dev/stdin", "utf8");

let [H, N] = input.split(" ").map(s => ~~s);

let count = 0;

while (H > 0) {
    H = H - N;
    count = count + 1;
}

console.log(count);
//  [typescript]
import * as fs from 'fs';

const input = fs.readFileSync('/dev/stdin', 'utf8').split(/[ \n]/);
const h = +input[0];
const a = +input[1];

console.log(Math.ceil(h / a));
//  [typescript]
export class HeroDetailService {

    constructor() { }
    CalcAttackTimes(HP: number , Attack: number): number {
       let CountTimes: number;
      CountTimes = 0;
      for(;HP > 0; this.JudgeWinLose(HP) == false){
        HP = this.CalcHp(HP,Attack);
        CountTimes++;
       }
       return CountTimes;
      }

    CalcHp(HP: number , Attack: number): number {
      return HP - Attack;
    }

    JudgeWinLose(HP: number): boolean {
      if(HP <= 0 ){
        return false;
      }
      else if(HP > 0){
        return true;
      }
    }
}
//  [typescript]
const main = arg => {
  const [H, A] = arg.trim().split(' ');
  console.log(parseInt(H / A) + 1);
}
main(require('fs').readFileSync('/dev/stdin', 'utf8'));
//  [typescript]
const main = arg => {
  const [H, A] = arg.trim().split(' ');
  console.log(parseInt(H / A));
}
main(require('fs').readFileSync('/dev/stdin', 'utf8'));
//  [python]
n=input()
lst=input().split()
if len(lst)==len(set(lst)):
    print("YES")
else: print("NO")
//  [python]
n = int(input())
num = input().split()

if len(set(num)) == n:
  print("YES")
else:
  print("NO")
//  [python]
N = input()
A = input().split()
n = len(A)
n_temp = len(set(A))

if n != n_temp:
  print("NO")
else:
  print("YES")
//  [python]
n=int(input())
a = list(map(int,input().split()))
for i in range (n):
  for j in range(n):
    if i != j:
      if a[i] == a[j]:
        print('NO')
        exit()
print('YES')
//  [python]
N = int(input())
nums = set(map(int, input().split()))

if len(nums) == N:
  print("Yes")
else:
  print("No")
//  [python]
n = int(input())
a = list(map(int, input().split()))

for i in range(n):
    if a.count(a[i]) == 1:
        continue
    else:
        print('NO')
        exit()

print('YES')
//  [java]
import java.util.*;

public class Main {
    public static void main(String args[]) {
        Scanner scn = new Scanner(System.in);
        int n = scn.nextInt();
        ArrayList<String> intList = new ArrayList<String>();

        for(int i=0;i<n;i++){
            intList.add(scn.next());
        }

        Set<String> intSet = new HashSet<String>(intList);

        if(n==intSet.size()){
            System.out.println("Yes");
        }else{
            System.out.println("No");
        }

        scn.close();

    }


}
//  [java]
import java.util.*;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int now = 0;
        ArrayList<Integer> c = new ArrayList<Integer>();
        for (int i = 0; i < n; i++) {
            now = sc.nextInt();
            if (c.contains(now)) {
                System.out.println("NO");
                System.exit(0);
            } else {
                c.add(now);
            }
        }
        System.out.println("YES");
    }
}
//  [java]
import java.util.*;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        Integer[] a = new Integer[n];
        for(int i = 0; i < n; i++) {
            a[i] = sc.nextInt();
        }
        Arrays.sort(a);
        ArrayList<Integer> c = new ArrayList<Integer>();
        for(int i = 0; i < n; i++) {
            if(c.contains(a[i])) {
                System.out.println("NO");
                System.exit(0);
            }else{
                c.add(a[i]);
            }
        }
        System.out.println("YES");
    }
}