jiahuimbzuai/CoQuIR huggingface dataset:
//  [cpp]
//Zory-2020
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
// typedef __int128 ll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
#define FR first
#define SE second
#define MP make_pair
#define PB push_back
#define vc vector
#define all(x) (x).begin(),(x).end()
#define sz(x) ((int)(x).size())
#define bin(x) (1ll<<(x))
#define fo(i,l,r) for(int i=(l),I=(r);i<=I;i++)
#define fd(i,r,l) for(int i=(r),I=(l);i>=I;i--)
#define mem(x,val) memset(x,val,sizeof x)
#define Swap(a,b,n) for(int I=0;I<=n;I++) swap(a[I],b[I])
#define PC __builtin_popcountll
#ifdef DEBUG
#define DD 1
#else
#define DD 0
#endif
#define Debug if(DD) printf("line %d\n",__LINE__)
#define deb(x) if(DD) cerr<<#x<<'='<<x<<endl
#define debug if(DD) printf
namespace mine
{
	ll qread()
	{
		ll ans=0,f=1;char c=getchar();
		while(c<'0' or c>'9') {if(c=='-')f=-1;c=getchar();}
		while('0'<=c and c<='9') ans=ans*10+c-'0',c=getchar();
		return ans*f;
	}
	void write(ll num){if(num<0) putchar('-'),num=-num;if(num>=10) write(num/10);putchar('0'+num%10);}
	void write1(ll num){write(num);putchar(' ');}
	void write2(ll num){write(num);putchar('\n');}
	template<typename T>inline bool chmax(T&a,const T&b){return a<b?a=b,1:0;}
	template<typename T>inline bool chmin(T&a,const T&b){return a>b?a=b,1:0;}
	ll gcd(ll x,ll y){return y?gcd(y,x%y):x;}
	bool IN(ll x,ll l,ll r){return l<=x and x<=r;}
	void gg1(){write2(-1);exit(0);}
	void gg2(){puts("NO");exit(0);}
	
	const double eps=1e-8;
	const int INF=0x3f3f3f3f;
	const int MOD=1e9+7;
	int mm(const int x){return x>=MOD?x-MOD:x;}
	template<typename T> void add(T &x,const int &y){x=(x+y>=MOD?x+y-MOD:x+y);}
	ll qpower(ll x,ll e,int mod=MOD){ll ans=1;while(e){if(e&1)ans=ans*x%mod;x=x*x%mod;e>>=1;}return ans;}
	ll invm(ll x){return qpower(x,MOD-2);}
	const int M=5e6+10;
	ll fac[M],facinv[M];ll C(int n,int m){return n<0 or n<m?0:fac[n]*facinv[m]%MOD*facinv[n-m]%MOD;}
	void PRE()
	{
		fac[0]=1;fo(i,1,M-1) fac[i]=fac[i-1]*i%MOD;
		facinv[M-1]=invm(fac[M-1]);fd(i,M-1,1) facinv[i-1]=facinv[i]*i%MOD;
	}
	
	const int N=1e6+10;
	int x[N];
	void main()
	{PRE();
		int n=qread(),K=qread();
		int now=1,mx=K;while(mx-1<n) mx*=K,now++;write(now);
	}
};//变量重名！
signed main()
{
	#ifdef DEBUG
	//freopen("a.in","r",stdin);
	freopen("z.txt","r",stdin);
	#endif
	srand(time(0));
	mine::main();
	if(DD) cerr<<"\n---------------------Zory-------------------\nTime: " <<1.0*clock()/CLOCKS_PER_SEC<<"s";
}
//  [c]
#include<stdio.h>
#include<stdlib.h>
#include<string.h>
#include<math.h>
typedef long long ll;


int main()
{
    int n,k;
    scanf("%d %d",&n,&k);
    int ans=0;

    while(n>0)
    {
        n=n/k;
        ans=ans+1;
    }
    
    printf("%d\n",ans);


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

int main(){
	int n, k;
	long long pow = 1;
	int cnt = 0;

	scanf("%d %d", &n, &k);

	while(1){
		cnt++;
		pow *= k;
		if((long long)n < pow){
			break;
		}
	}

	printf("%d", cnt);

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

int main(void){
    int n,k,x=0;
    scanf("%d %d\n",&n,&k);
    while(n!=0){
        n=n/k;
        x++;
    }
    printf("%d\n",x);
    return 0;
}
//  [c]
#include<stdio.h>

int main(void){

int n,k,i;

scanf("%d %d",&n,&k);

for(i=0;;i++){
if(n<k){break;}
else{
n=n/k;
}
}

printf("%d",i+1);

return 0;
}
//  [c]
#include <stdio.h>
int main(){
  long long n,k,cnt=1;
  scanf("%lld%lld", &n, &k);
  while( n >= k ){
    n /= k;
    cnt++;
  }
  printf("%lld", cnt);
  return 0;
}
//  [c]
#include <stdio.h>
#include <math.h>

int main(void){
    double n, k;
    scanf("%lf %lf", &n, &k);
    int ans = (int)round(ceil(log(n)/log(k)));
    if(pow(k, ans)==n) ans++;
    printf("%d\n", ans);
    return 0;
}
//  [javascript]
function Main(input) {
  var split = input.split(' ');
  var value = +split[0];
  var digit = +split[1];
  var result = '';
  while(value > 0) {
    result += value % digit;
    value = Math.floor(value / digit);
  }
  console.log(result.length);
}
//*この行以降は編集しないでください（標準入出力から一度に読み込み、Mainを呼び出します）
Main(require("fs").readFileSync("/dev/stdin", "utf8"));
//  [javascript]
function main(input) {
    input = input.trim().split(" ");
    var n = parseInt(input[0]);
    var k = parseInt(input[1]);
    var cnt = 0;
    while (true) {
        n /= k;
        cnt ++;
        if (n < 1) {
            break;
        } 
    }
    console.log(cnt);
}
main(require('fs').readFileSync('/dev/stdin', 'utf8'));
//  [javascript]
function Main(input) {
	input = input.split(" ");
  	const N = Number(input[0]) // 数字
  	const K = Number(input[1]) // 進数
    const decimalNum = parseInt(N, 10) // 10進数に変換
    const converted = decimalNum.toString(K) // K進数に変換
    console.log(String(converted).length)
}
 
Main(require("fs").readFileSync("/dev/stdin", "utf8"));
//  [javascript]
"use strict"

function Main(input) {
  input = input.trim().split(' ').map(Number);

  console.log(input[0].toString(input[1]).length);
}
Main(require("fs").readFileSync("/dev/stdin", "utf8"));
//  [javascript]
function Main(input) {
	input = input.split(" ").map(Number);
	var mem = input[0].toString(input[1]);
 	// mem = mem.split("");
 //console.log(mem)
	console.log(mem.length)
}Main(require("fs").readFileSync("/dev/stdin", "utf8").trim());
//  [javascript]
function main(input) {
  const inputs =input.split('\n')
  const [N, K] = inputs[0].split(' ').map(Number)

  if (N === 1) {
    console.log(1)
  } else {
    console.log(
      Math.ceil(Math.log(N) / Math.log(K))
    )
  }
}

main(require('fs').readFileSync('/dev/stdin', 'utf8'))
//  [go]
package main

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

var stdInScanner = bufio.NewScanner(os.Stdin)

func nextInt() int {
	stdInScanner.Scan()
	i, _ := strconv.Atoi(stdInScanner.Text())
	return i
}

func main() {
	stdInScanner.Split(bufio.ScanWords)

	N := nextInt()
	K := nextInt()

	fmt.Println(len(strconv.FormatInt(int64(N), K)))
}
//  [go]
package main

import (
	"fmt"
	"strconv"
)

func main() {
	var n, k int
	fmt.Scan(&n, &k)

	fmt.Println(len(string(strconv.FormatInt(int64(n), k))))
}
//  [go]
package main

import (
  "fmt"
)

func main() {
  var n, k int 
  fmt.Scan(&n, &k)
  cnt := 0
  for n > 0 {
    n /= k
    cnt++
  }
  fmt.Println(cnt)
}
//  [go]
package main

import "fmt"

func main() {
	var n, k int
	fmt.Scan(&n, &k)

	count := 0
	for n > 0{
		n = n / k
		count++
	}

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

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

func solve() {
	n, k := getInt(), getInt()
	ans := 0
	for n > 0 {
		ans++
		n /= k
	}

	fmt.Fprintln(wr, ans)
}

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

const (
	inf = 1 << 60
	// mod = 1000000007
)

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

func main() {
	maxBufSize := int(1e8)
	sc.Buffer(make([]byte, 4096), maxBufSize)
	sc.Split(bufio.ScanWords)
	solve()
	wr.Flush()
}

func getInt() (ret int) {
	sc.Scan()
	ret, err := strconv.Atoi(sc.Text())
	if err != nil {
		panic(err)
	}
	return
}

func getIntSlice(n int) (ret []int) {
	ret = make([]int, n)
	for i := range ret {
		ret[i] = getInt()
	}
	return
}

func getString() (ret string) {
	sc.Scan()
	ret = sc.Text()
	return
}

func getRunes() (ret []rune) {
	ret = []rune(getString())
	return
}
//  [go]
package main

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

func main() {
	n, k := readI(), readI()
	a := k
	for i := 1; ; i++ {
		if n < a {
			fmt.Println(i)
			return
		}
		a *= k
	}
}

/*-----------Input utils-----------*/

var sc = bufio.NewScanner(os.Stdin)

func init() {
	if len(os.Args) >= 2 {
		if os.Args[1] == "debug" {
			debug()
		}
	}
	const buf = 200100
	sc.Split(bufio.ScanWords)
	sc.Buffer(make([]byte, buf), buf)
}

func debug() {
	testFile, err := os.Open("./test/sample-1.in")
	if err != nil {
		fmt.Fprintln(os.Stderr, "There is no testfile.")
		os.Exit(1)
	}
	sc = bufio.NewScanner(testFile)
}

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

func readR() []rune {
	return []rune(readS())
}

func readI() int {
	i, _ := strconv.Atoi(readS())
	return i
}

func readF() float64 {
	f, _ := strconv.ParseFloat(readS(), 64)
	return f
}
//  [ruby]
n, k = gets.split.map(&:to_i)
puts n.to_s(k).size
//  [ruby]
n, k = gets.split.map(&:to_i)

change = n.to_s(k)

puts change.size
//  [ruby]
n, k = gets.chomp.split.map(&:to_i)
ans = n.to_s(k).length
puts ans
//  [ruby]
n, k = gets.chop.split.map(&:to_i)
p n.to_s(k).size
//  [ruby]
n,k = gets.chomp.split(' ').map(&:to_i)
puts n.to_s(k).size
//  [ruby]
require 'set'

class Hash
  def push(key, value)
    self[key] = [] if self[key] == nil
    self[key].push(value)
  end
end

class Array
  def lower_bound(value)
    left = -1;
    right = self.length;
    while left + 1 < right
      mid = left + (right - left) / 2;
      if self[mid] >= value
        right = mid
      else
        left = mid
      end
    end
    right
  end

  def unique
    res = [self.first]
    each_cons(2) do |a, b|
      if a != b
        res.push(b)
      end
    end
    res
  end
end

def get_ints
  gets.split.map(&:to_i)
end

def get_ints_minus_one
  get_ints.map { |x| x - 1 }
end

def get_int
  gets.chomp.to_i
end

N, K = get_ints

puts N.to_s(K).length
//  [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")
    };
}
/* }}} */

pub fn digit_num(mut n: u64, d: u64) -> u64 {
    let mut k = 0;
    while n != 0 {
        k += 1;
        n /= d;
    }
    k
}

fn main() {
    input! {
        n: u64,
        k: u64
    }
    println!("{}", digit_num(n,k));
}
/* vim:set foldmethod=marker: */
//  [rust]
// Vicfred
// https://atcoder.jp/contests/abc156/tasks/abc156_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 mut n = words[0];
    let k = words[1];

    let mut digits = 0;

    while n > 0 {
        n /= k;
        digits += 1;
    }

    println!("{}", digits);
}
//  [rust]
#![allow(unused, non_snake_case, dead_code, non_upper_case_globals)]
use std::cmp::*;
use std::collections::*;
use std::mem::*;

fn main() {
    let (r, w, e) = (std::io::stdin(), std::io::stdout(), std::io::stderr());
    let mut io = IO::new(r.lock(), w.lock(), e.lock());
    let (n, k) = (io.read::<usize>(), io.read::<usize>());

    let mut n = n;
    let mut ans = 0;
    while n > 0 {
        n /= k;
        ans += 1;
    }
    io.writeln(ans);
}

static MOD: i64 = 1000000007;
// IO
use std::io::*;
struct IO<R: Read, W: Write, E: Write> {
    Read: R,
    Write: BufWriter<W>,
    Error: BufWriter<E>,
}
impl<R: Read, W: Write, E: Write> IO<R, W, E> {
    fn new(r: R, w: W, e: E) -> IO<R, W, E> {
        IO {
            Read: r,
            Write: BufWriter::new(w),
            Error: BufWriter::new(e),
        }
    }
    fn read<T>(&mut self) -> T
    where
        T: std::str::FromStr,
    {
        let next: String = self
            .Read
            .by_ref()
            .bytes()
            .map(|c| c.unwrap() as char)
            .skip_while(|c| c.is_whitespace())
            .take_while(|c| !c.is_whitespace())
            .collect();
        next.parse().ok().unwrap()
    }
    fn chars(&mut self) -> Vec<char> {
        self.read::<String>().chars().collect()
    }
    fn readn<T: std::str::FromStr>(&mut self, n: usize) -> Vec<T> {
        (0..n).map(|_| self.read::<T>()).collect::<Vec<_>>()
    }
    fn readmat<T: std::str::FromStr>(&mut self, n: usize, m: usize) -> Vec<Vec<T>> {
        (0..n).map(|_| self.readn(m)).collect()
    }
    fn write<S: ToString>(&mut self, val: S) {
        self.Write.write(val.to_string().as_bytes());
    }
    fn writeln<S: ToString>(&mut self, val: S) {
        self.Write.write(val.to_string().as_bytes());
        self.Write.write(b"\n");
    }
    fn debug<S: std::fmt::Debug>(&mut self, val: S) {
        writeln!(self.Error, "(debug) {:?}", &val);
    }
    fn debug2<S: std::fmt::Debug, T: std::fmt::Debug>(&mut self, val1: S, val2: T) {
        writeln!(self.Error, "(debug2) {:?} -> {:?}", val1, val2);
    }
    fn debug3<S: std::fmt::Debug, T: std::fmt::Debug, U: std::fmt::Debug>(
        &mut self,
        val1: S,
        val2: T,
        val3: U,
    ) {
        writeln!(
            self.Error,
            "(debug3) {:?} -> {:?} -> {:?}",
            val1, val2, val3
        );
    }
}
//  [swift]
import Foundation

let inputs = readLine()!.components(separatedBy: " ").map{ Double($0)! }
let N = inputs[0]
let K = inputs[1]
var digits = 0

for i in 0...100{
    if N >= pow(K, Double(i)) {
        digits += 1
    }
}

print(digits)
//  [swift]
import Foundation

/*
// 1
let N = Int(readLine()!)!

// 1 2
let split = readLine()!.componentsSeparatedByString(" ")
let N = Int(split[0])!
let S = Int(split[1])!

// 1 2 3 4 5
let array = readLine()!.componentsSeparatedByString(" ").map { Int($0)! }
*/

let split = readLine()!.componentsSeparatedByString(" ")
let N = Int(split[0])!
let K = Int(split[1])!
var i = 0

func pow(_ number: Int, multiplier: Int) -> Int {
  var answer = 1
  for _ in 0 ..< multiplier {
    answer *= number 
  }
  return answer
}

while (true) {
  if N == 1 { print(1); break }
  if N < pow(K, multiplier: i) {
  	print(i)
    break
  }
  i += 1
}
//  [typescript]
import * as fs from "fs";

const input = (fs.readFileSync("/dev/stdin", "utf8") as string).split("\n");
const [n, k] = input[0].split(" ").map((x: string): number => +x);

console.log(n.toString(k).length);
//  [typescript]
class AtCoder {
  // 入力系
  input=require('fs').readFileSync('/dev/stdin','utf8').split(/[\s]/);
  input_i=-1;

  n(){
    this.input_i++;
    return Number(this.input[this.input_i]);
  }
  nn(n:number):number[]{
    const a=[];
    for(let i=0;i<n;i++){
      a.push(this.n());
    }
    return a;
  }
  s(){
    this.input_i++;
    return String(this.input[this.input_i]);
  }
  ss(n:number):string[]{
    const a=[];
    for(let i=0;i<n;i++){
      a.push(this.s());
    }
    return a;
  }

  // コンソール
  o(...a:any){
    console.log(...a);
  }

  // Math
  abs(a:number){
    return Math.abs(a);
  }
  min(...a:number[]){
    return Math.min(...a);
  }
  max(...a:number[]){
    return Math.max(...a);
  }
  floor(a:number){
    return Math.floor(a);
  }
  ceil(a:number){
    return Math.ceil(a);
  }
  round(a:number){
    return Math.round(a);
  }

  // ソート
  asc(ar:number[]){
    const t=[...ar];
    ar.sort((a,b)=>{return a-b});
  }
  desc(ar:number[]){
    const t=[...ar];
    ar.sort((a,b)=>{return b-a});
  }

  // 自作
  gcd(...arr:number[]):number{
    for(let i=0;i<arr.length-1;i++){
      let [x,y]=[arr[i],arr[i+1]];
      while(y){
        [x,y]=[y,x%y];
      }
      arr[i+1]=x;
    }
    return arr[arr.length-1];
  };
  lcm(...arr:number[]):number{
    for(let i=0;i<arr.length-1;i++){
      let [x,y]=[arr[i],arr[i+1]];
      while(y){
        [x,y]=[y,x%y];
      }
      arr[i+1]=arr[i]*arr[i+1]/x;
    }
    return arr[arr.length-1];
  };
  isPrime(n:number):boolean{
    if(n < 2) return false;
    const suq=Math.sqrt(n);
    for(let i=2;i<=suq;i++){
      if(n%i==0){
        return false;
      }
    }return true;
  };
  deduplicate(a:any[]):any[]{
    return Array.from(new Set(a));
  };
  f(roop:number, callback:any){
    for(let i=0;i<roop;i++){
      callback(i);
    }
  };
  Yes(){
    console.log('Yes');
  }
  No(){
    console.log('No');
  }
  YES(){
    console.log('YES');
  }
  NO(){
    console.log('NO');
  }
}
const m = () => {
  const o = new AtCoder();
  let [n,k] = o.nn(2);
  o.o(n.toString(k).length)
}
m();
//  [typescript]
class NormalInput {
  input: string[];
  pointer: number;
  constructor(raw: string) {
    this.input = raw.split(/ |\n/);
    this.pointer = 0;
  }
  int = (): number => {
    const ret = parseInt(this.input[this.pointer], 10);
    this.pointer++;
    return ret;
  };
  str = (): string => {
    const ret = this.input[this.pointer];
    this.pointer++;
    return ret;
  };
  strs = (length: number): string[] => {
    let ret: string[] = [];
    for (let i = 0; i < length; i++) {
      ret.push(this.str());
    }
    return ret;
  };
  ints = (length: number): number[] => {
    let ret: number[] = [];
    for (let i = 0; i < length; i++) {
      ret.push(this.int());
    }
    return ret;
  };
}
function order(N, K) {
  if (N < 1) return 0;
  else return 1 + order(Math.floor(N / K), K);
}
function Main({ int, str, strs, ints }: NormalInput) {
  const N = int();
  const K = int();

  console.log(order(N, K));
}

//DO NOT EDIT
Main(new NormalInput(require("fs").readFileSync("/dev/stdin", "utf8")));
//  [typescript]
import * as fs from 'fs';
// main
function main(input: string[]) {
    // param
    let n, k;
    let ans;
    // init
    [n, k] = input.shift().split(" ").map(x => Number(x));
    // solve
    ans = 0;
    do {
        n = Math.floor(n / k);
        ans++;
    }
    while (n != 0);
    // answer
    console.log(ans);
}
// entrypoint
function entrypoint() {
    try {
        // linux
        let input = fs.readFileSync("/dev/stdin", "utf8").trim().split("\n");
        console.debug = function () { };
        main(input);
    }
    catch (ex) {
        // windows
        const lines: string[] = [];
        // @ts-ignore
        const reader = require('readline').createInterface({
            // @ts-ignore
            input: process.stdin,
            // @ts-ignore
            output: process.stdout
        });
        reader.on('line', function (line: string) {
            lines.push(line);
        });
        reader.on('close', function () {
            let input = lines;
            main(input);
        });
    }
}
entrypoint();
//  [typescript]
    // inputに入力データ全体が入る
    function Main(inputString) {
    	let inputArray = inputString.split(" ");
    	//文字列から10進数に変換するときはparseIntを使います
    	let defaultNumber = parseInt(inputArray[0], 10);
        let baseNumber = parseInt(inputArray[1], 10);
        
        // m進数をn進数に変換するときはNumber.tostringを使います
        let resultNumber = Number(defaultNumber).toString(baseNumber);
        let digits = resultNumber.length
    	//出力
        console.log('%d', digits);
        
    }
        //*この行以降は編集しないでください（標準入出力から一度に読み込み、Mainを呼び出します）
        Main(require("fs").readFileSync("/dev/stdin", "utf8"));
//  [typescript]
import * as fs from 'fs';

const input = fs.readFileSync("/dev/stdin", "utf8").split(" ");
const N = +input[0];
const K = +input[1];

let strNtoK = N.toString(K);
console.log( strNtoK.length );
//  [python]
import sys
import numpy as np
import numba
from numba import jit

read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines

from heapq import heappop,heappush,heapify

@jit
def main(n, a):
  for _ in range(1, n):
    x = heappop(a)
    y = heappop(a)
    heappush(a, (x + y)/2)
  return a[0]

n,*a = map(int,read().split())
heapify(a)
print(main(n,a))
//  [python]
from heapq import heapify,heappush,heappop

N=int(input())
V=list(map(int,input().split()))
heapify(V)

while len(V)>=2:
    a=heappop(V)
    b=heappop(V)
    heappush(V,(a+b)/2)

c=heappop(V)
print(c)
//  [python]
import bisect
import heapq
import itertools
import math
import operator
import os
import re
import string
import sys
from collections import Counter, deque, defaultdict
from copy import deepcopy
from decimal import Decimal
from fractions import gcd
from functools import lru_cache, reduce
from operator import itemgetter, mul, add, xor

import numpy as np

if os.getenv("LOCAL"):
    sys.stdin = open("_in.txt", "r")

sys.setrecursionlimit(2147483647)
INF = float("inf")
IINF = 10 ** 18
MOD = 10 ** 9 + 7

N = int(sys.stdin.readline())
V = list(map(int, sys.stdin.readline().split()))
V.sort()


def mean(a, b):
    return (a + b) / 2


a = reduce(mean, V)
print(a)
//  [java]
import java.io.PrintWriter;
import java.util.*;
import java.util.stream.Collectors;

public class Main {

    private static Scanner in = new Scanner(System.in);
    private static PrintWriter out = new PrintWriter(System.out);

    private static final long MOD = (long) 1e9 + 7;

    public static void main(String[] args) {
        solve();
        out.flush();
    }

    private static void solve() {
        int n = in.nextInt();

        List<Double> v = new ArrayList<>();
        for (int i=0; i < n; i++)
            v.add((double) in.nextInt());

        while (v.size() > 1) {
            v.sort(((o1, o2) -> {
                if (o1 > o2) return 1;
                else if (o1 < o2) return -1;
                return 0;
            }));

            double v1 = v.get(0);
            double v2 = v.get(1);
            v.remove(0);
            v.remove(0);
            v.add((v1 + v2) / 2);
        }

        out.println(v.get(0));
    }

}
//  [java]

import java.util.Arrays;
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int num = Integer.valueOf(sc.nextLine());
        String[] values = sc.nextLine().split(" ");
        sc.close();

        int[] converted = Arrays.stream(values).mapToInt(Integer::parseInt).sorted().toArray();
        double v = (converted[0] + converted[1]) / 2.0;
        
        for (int i = 2; i < num; i++) {
            v = (v + converted[i]) / 2.0;
        }
        System.out.println(v);
    }
}
//  [c]
#include <stdio.h>
#include <math.h>
#include <time.h>
#include<stdlib.h>
#include<string.h>

void swap(int* x, int* y) {
	int tmp;

	tmp = *x;
	*x = *y;
	*y = tmp;
}

void sort(int array[], int n) {
	int i, j;
	for (i = 0; i < n - 1; i++) {
		for (j = n - 1; j >= i + 1; j--) {
			if (array[j] < array[j - 1]) {
				swap(&array[j], &array[j - 1]);
			}
		}
	}
}

int main(void) {
	float v[1000], max = 0;
	int n, i;

	scanf("%d", &n);

	for (i = 0; i < n; i++) {
		scanf("%f", &v[i]);
	}

	sort(v, n);

	for (i = 0; i < n - 1; i++) {
		if (i == 0) {
			max += (v[i] + v[i + 1]) / 2;
		}
		else {
			max = (max + v[i + 1]) / 2;
		}
	}
	printf("%f", max);
}
//  [c]
#include <stdio.h>
#include <stdlib.h>

int f(const void *a,const void *b){
  return *(double*)b-*(double*)a;
}

int main(){
  int N;
  double v[55];
  double S=0.0,P=2.0;
  scanf("%d",&N);
  for(int i=0;i<N;i++)
    scanf("%lf",v+i);
  qsort(v,N,sizeof(double),f);
  for(int i=0;i<N;i++){
    S+=v[i]/P;
    if(i<N-2) P*=2.0;
  }
  printf("%lf\n",S);
  return 0;
}
//  [c]
#include <stdio.h>
#include <stdlib.h>

int compare_int(const void *a, const void *b)
{
    return *(int*)a - *(int*)b;
}

int main(){
  int n;
  int v[53];
  int i;
  double suti = 0;
  
  
  scanf("%d", &n);
  for(i = 0; i < n; i++)
    scanf("%d", &v[i]);
  
  qsort(v, n, sizeof(int), compare_int);
    
    for(i = 0; i < n - 1; i++){
        if(i == 0){
            suti = (v[i] + v[i + 1]) / (double)2;
        }
        else{
            suti = (suti + v[i + 1]) / (double)2;
        }
    }
    
    printf("%f\n", suti);
  
  return 0;
}
//  [javascript]
function Main(input) {
	var list = input.split("\n")[1].split(" ");
   var output = 0;
  for(var i = 0; i < list.length; i++){
    list[i] = parseInt(list[i]);
  }
  list.sort(function(a,b){
  	return a - b;
  });
  while(list.length != 1){
    var x = list[0];
    var y = list[1];
    var make = (x + y) / 2;
    list.shift();
    list[0] = make;
  }
  console.log(list[0]);
}

Main(require("fs").readFileSync("/dev/stdin", "utf8"));
//  [javascript]
'use strict'

const main = (INPUT) => {
  const input = INPUT.split('\n')
  const N = input[0]
  const u = input[1].split(' ').map(n => Number(n)).sort((a, b) => a - b)
  while (u.length >= 2) {
    const a = u.shift()
    const b = u.shift()
    const tmp = (a + b) / 2
    u.push(tmp)
    u.sort((a, b) => a - b)
  }
  console.log(u[0])
}

main(require('fs').readFileSync('/dev/stdin', 'utf8'))
//  [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);
  console.error("\n");
  var start = Date.now();
  Main();
  var end = Date.now() - start;
  myerr("time : " + (end) + "ms");
  myerr("memory : " + Math.round(process.memoryUsage().heapTotal / 1024) + "KB");
});
function makeClone(obj){return JSON.parse(JSON.stringify(obj));}
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 list = nextIntArray();
	var sum = 0;
	list.sort(function(a,b){
		return a - b;
	});
	for(var i = 0; i < N - 1; i++){
		var mae = list.shift();
		var ato = list.shift();
		var newV = (mae + ato) / 2;
		list.unshift(newV);
	}
	myout(list[0]);
}
//  [go]
package main

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

const (
	initialBufSize = 100000
	maxBufSize     = 1000000
)

var sc *bufio.Scanner

func initScanner(r io.Reader) *bufio.Scanner {
	buf := make([]byte, initialBufSize)

	sc := bufio.NewScanner(r)
	sc.Buffer(buf, maxBufSize)
	sc.Split(bufio.ScanWords) // bufio.ScanLines
	return sc
}

func main() {
	sc = initScanner(os.Stdin)
	fmt.Printf("%.6f\n", parseProblem())
}

func parseProblem() float64 {
	n := scanInt(sc)
	vs := nextIntSlice(sc, n)
	sort.Sort(sort.IntSlice(vs))
	v := float64(vs[0])
	for i := 1; i < len(vs); i++ {
		v = (v + float64(vs[i])) / 2.0
	}
	return v
}

func nextInt(sc *bufio.Scanner) int {
	sc.Scan()
	a, _ := strconv.Atoi(sc.Text())
	return int(a)
}

func nextString(sc *bufio.Scanner) string {
	sc.Scan()
	return sc.Text()
}

func nextIntSlice(sc *bufio.Scanner, n int) (a []int) {

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

func resolve(n int) int {
	return n
}

// snip-scan-funcs
func scanInt(sc *bufio.Scanner) int {
	sc.Scan()
	i, _ := strconv.Atoi(sc.Text())
	return int(i)
}
func scanString(sc *bufio.Scanner) string {
	sc.Scan()
	return sc.Text()
}
//  [go]
package main
 
import (
	"bufio"
	"os"
	"strconv"
	"fmt"
	"sort"
)
 
var sc = bufio.NewScanner(os.Stdin)
 
func init() {
	sc.Split(bufio.ScanWords)
	sc.Buffer(make([]byte, 1024*1024), bufio.MaxScanTokenSize)
}
 
//func nextString() string {
//	sc.Scan()
//	return sc.Text()
//}
 
func nextInt() int {
	sc.Scan()
	i, e := strconv.Atoi(sc.Text())
	if e != nil {
		panic(e)
	}
	return i
}

var N int
var ANS float64
var L []int
func main() {
	N = nextInt()
	L = make([]int, N)
	for i := 0; i < N; i++ {
		L[i] = nextInt()
	}
	sort.Slice(L, func (i, j int) bool { return L[i] < L[j]})
	ANS = float64(L[0])
	for i := 1; i < N; i++ {
		ANS = (ANS + float64(L[i])) / float64(2)
	}
	fmt.Println(ANS)
}
//  [go]
package main

import (
	"fmt"
	"sort"
)

func main() {
	var n int
	fmt.Scan(&n)
	vs := make([]int, n)
	for i := range vs {
		fmt.Scan(&vs[i])
	}

	sort.Ints(vs)
	sum := float64(vs[0])
	for i := 1; i < n; i++ {
		sum = (sum + float64(vs[i])) / 2
	}

	fmt.Println(sum)
}
//  [ruby]
n = gets.to_i
v = gets.chomp.split.map(&:to_i)

v.sort!

ans = -1

v.each do |x|
  if ans == -1
    ans = x
  else
    ans = (ans + x) / 2.0
  end
end

puts ans
//  [ruby]
n = gets.to_i
v = gets.split.map(&:to_f).sort
(n-1).times do 
  y=v.shift
  v[0]=(y+v[0])/2
end
puts v
//  [ruby]
n = gets.to_i
arr = gets.chomp.split(' ').map(&:to_i).sort!
k = 0
while k < n-1
  arr[k+1] = (arr[k] + arr[k+1])/2.0
  k += 1
end 
puts arr[n-1]
//  [rust]
use proconio::{input, fastout};

#[fastout]
fn main() {
    input!{
        n: i32,
        mut v: [i32; n],
    }
    v.sort();
    let mut r = v[0] as f64;
    for &i in v[1..].iter() {
        r = (r + i as f64) / 2f64;
    }
    println!("{}", r);
}
//  [rust]
use proconio::{fastout, input};
use std::cmp::Ordering;

#[fastout]
fn main() {
    input! {n: usize, v: [f64; n]};

    let mut v: Vec<f64> = v;
    v.sort_by(cmp_f64);

    while v.len() > 1 {
        let m1 = v.pop().unwrap();
        let m2 = v.pop().unwrap();
        v.push((m1 + m2) / 2.0);
        v.sort_by(cmp_f64);
    }

    println!("{}", v[0]);
}

fn cmp_f64(a: &f64, b: &f64) -> Ordering {
    if a < b {
       return Ordering::Greater;
    } else if a > b {
      return Ordering::Less;
    }
    return Ordering::Equal;
}
//  [rust]
use text_io::*;
use std::collections::*;
use std::process::exit;

fn main() {
    let mut n:usize = read!();
    let mut v:Vec<usize> = Vec::new();
    for i in 0..n {
        let mut a:usize = read!();
        v.push(a);
    }
    v.sort();
    let mut ans:f64 = v[0]as f64;
    for i in 0..n {
        ans=(ans+v[i]as f64)/2.0;
    }
    println!("{}",ans);
}
//  [swift]
// 🐋💭
import Foundation

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

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

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

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

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

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

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

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

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

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

func main() {
    let _ = readDouble()
    var aryV = readDoubles()
    //_______________________ここまで入力
    while aryV.count > 1 {
        aryV.sort(by: <)
        aryV.append((aryV[0] + aryV[1]) / 2)
        
        aryV.removeFirst(2)
    }
    
    print(aryV[0])
}
main()
//  [typescript]
// general helpers
const debug = (message?: any, ...optionalParams: any[]) => {
  if (process.env.LOCAL_DEBUG === '1') console.log(message, ...optionalParams)
}

// helpers
const parseLines = (
  lines: string[]
): { N: number, v: number[] } => {
  const N = +lines[0]
  const v = lines[1].split(' ').map(line => +line)
  const obj = { N, v }
  debug(obj)
  return obj
}
// solver
export const solve = (lines: string[]): string => {
  const { N, v } = parseLines(lines)
  v.sort((a, b) => a - b)
  const first = v.shift() || 0
  const result = v.reduce((prev, current) => (prev + current) / 2, first)
  return `${result}`
}

// main
const main = (lines: string[]) => {
  console.log(solve(lines))
}

// exec main function for submit
if (process.env.LOCAL_DEBUG !== '1') {
  const { stdin: input, stdout: output } = process
  input.resume()
  input.setEncoding('utf8')
  const lines: string[] = []
  require('readline')
    .createInterface({ input, output })
    .on('line', (line: string) => lines.push(line))
    .on('close', () => main(lines))
}
//  [typescript]
function Main(input: string) {
  // 1行目がinput[0], 2行目がinput[1], …に入る
  const args = input.split("\n");
  // const N: number = parseInt(args[0], 10);
  const A: number[] = args[1].split(" ").map(s => parseInt(s, 10));
  A.sort((a, b) => a - b);

  let result = (A[0] + A[1]) / 2;
  for (let i = 2; i < A.length; i++) {
    const v = A[i];
    result = (result + v) / 2;
  }
  console.log(result);
}

// *この行以降は編集しないでください（標準入出力から一度に読み込み、Mainを呼び出します）
// Main(require("fs").readFileSync("./input", "utf8"));
Main(require("fs").readFileSync("/dev/stdin", "utf8"));
//  [typescript]
'use strict'
function main(input: string) {
    const u: number[] = input.split('\n')[1].split(' ').map(Number).sort((a,b) => {return a - b});
    const r = u.reduce((acc, cur) => (acc + cur) / 2);
    console.log(r);
}
main(require('fs').readFileSync('/dev/stdin', 'utf8'));
//  [python]
A,B=[int(s) for s in input().split()]
a=A//100
b=B//100
def pal(num):
  return num*101-num%10-(num//100)*99
ans=b-a-1
if pal(a)>=A:
  ans+=1
if pal(b)<=B:
  ans+=1
print(ans)
//  [python]
a,b=input().split()
c=int(a[:3]+a[1]+a[0])
if int(a)>c:
  x=c//100+1
else:
  x=c//100
d=int(b[:3]+b[1]+b[0])
if int(b)<d:
  y=d//100-1
else:
  y=d//100
print(y-x+1)
//  [python]
a,b = input().split()
r = int(b[0:3])-int(a[0:3])+1
if int(a[3:5]) > int(a[0:2][::-1]):
  r -= 1
if int(b[3:5]) < int(b[0:2][::-1]):
  r -= 1
print(r)
//  [python]
L = []
for i in range(1, 10):
    for j in range(0, 10):
        for k in range(0, 10):
            L.append(i * 10000 + j * 1000 + k * 100 + j * 10 + i)
a, b = map(int, input().split())
print(sum(i in L for i in range(a, b + 1)))
# print(sum(a <= e <= b for e in L))
//  [python]
import math as m
C = input().split()
A = int(C[0])
B = int(C[1])

count = 0
for i in range(A, B+1):
    i2 = i
    change = 0
    keta = int(m.log(i, 10))
    for j in range(keta, -1, -1):
        change += int(i2/(10**j))*(10**(keta-j))
        i2 -= int(i2/(10**j))*(10**j)
    #print(change)
    if i == change:
        count += 1

print(count)
//  [python]
A,B=map(int,input().split())
import copy
M=0
for i in range(A,B+1):
    a=list(str(i))
    b=copy.deepcopy(a)
    b.reverse()
    if a==b:
        M+=1
print(M)
//  [java]
import java.io.*;

public class Main {
  
  public static void main(String[] args) throws IOException
  {
    BufferedReader r = new BufferedReader(new InputStreamReader(System.in), 1);
    String s = r.readLine();
    String sl[] = s.split(" ");
    int a = Integer.parseInt(sl[0]);
    int b = Integer.parseInt(sl[1]);
    int v = 0;
    for(int i = a; i <= b; i++)
    {
      if(i % 10 == i / 10000 && i / 10 % 10 == i / 1000 % 10)
      {
        v++;
      }
    }
    System.out.println(v);
  }
}
//  [java]
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;

public class Main {
	final int _intMax = Integer.MAX_VALUE; // =2147483647>10^9
	final int _intMin = Integer.MIN_VALUE;
	final long _longMax = Long.MAX_VALUE; // =9223372036854775807L>10^18
	final long _longMin = Long.MIN_VALUE;
	static boolean bElapsed = false;

	void solve() {
		int[] ia = readNums();
		int a = ia[0];
		int b = ia[1];
		int ans = 0;
		for (int i = a; i <= b; i++) {
			if (i / 10000 == i % 10) {
				if (i / 1000 % 10 == i / 10 % 10) {
					ans++;
				}
			}
		}
		pln(ans);
	}

	int pint(String s) {
		return Integer.parseInt(s);
	}

	long plong(String s) {
		return Long.parseLong(s);
	}

	String readLine() {
		try {
			return _in.readLine();
		} catch (IOException e) {
			throw new RuntimeException(e);
		}
	}

	int readNum() {
		String line = readLine();
		return pint(line);
	}

	String[] readFlds() {
		String line = readLine();
		return line.split(" ");
	}

	int[] readNums() {
		String[] flds = readFlds();
		int[] nums = new int[flds.length];
		for (int i = 0; i < flds.length; i++) {
			nums[i] = pint(flds[i]);
		}
		return nums;
	}

	void p(char c) {
		_out.print(c);
	}

	void pln(char c) {
		_out.println(c);
	}

	void p(double d) {
		_out.print(d);
	}

	void pln(double d) {
		_out.println(d);
	}

	void p(long l) {
		_out.print(l);
	}

	void pln(long l) {
		_out.println(l);
	}

	void p(String s) {
		_out.print(s);
	}

	void pln(String s) {
		_out.println(s);
	}

	static BufferedReader _in;
	static PrintWriter _out;

	public static void main(String[] args) {
		long start = System.currentTimeMillis();
		_in = new BufferedReader(new InputStreamReader(System.in));
		_out = new PrintWriter(System.out);
		new Main().solve();
		_out.flush();
		long end = System.currentTimeMillis();
		if (bElapsed) {
			System.err.println((end - start) + "ms");
		}
	}
}
//  [java]
import java.util.*;

class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    int a = sc.nextInt();
    int b = sc.nextInt();
    int ans =0;
    for (int i = a; i <= b; i++)
    {
      String as = Integer.toString(i);
      List<String> list=Arrays.asList(Integer.toString(i).split(""));
      Collections.reverse(list);
      String[] bs = (String[]) list.toArray(new String[list.size()]);
      String strb = String.join("", bs);
      if (as.equals(strb))
        ans++;
    }
    System.out.println(ans);
  }
}
//  [java]
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String a = sc.next();
        String b = sc.next();

        int count = 0;
        for (int i = Integer.parseInt(a); i <= Integer.parseInt(b); i++) {
            List<String> iList = Arrays.asList(String.valueOf(i).split(""));
            List<String> reverseList = new ArrayList<>();
            for (int j = iList.size() - 1; j >= 0; j--) {
                reverseList.add(String.valueOf(iList.get(j)));
            }
            for (int j = 0; j < iList.size(); j++) {
                if (!iList.get(j).equals(reverseList.get(j))) {
                    break;
                }
                if (j == iList.size() - 1) {
                    count++;
                }
            }
        }
        System.out.println(count);
    }

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

public class Main {
  public static void main (String[] args) {
    Scanner sc = new Scanner(System.in);
    
    int a = sc.nextInt();
    int b = sc.nextInt();
    int n = 0;
    
    for (int i = 0; i < (b - a + 1); i++) {
      String s[] = String.valueOf(a + i).split("");
      String t = s[4] + s[3] + s[2] + s[1] + s[0];
      
      if (String.valueOf(a + i).equals(t)) n++;
    }
    
    System.out.println(n);
  }
}
//  [cpp]
#include <iostream>
#include <string>
#include <algorithm>
#include <cmath>
#include <deque>
#include <queue>
#include <stack>
#include <vector>
#include <utility>
#include <iomanip>
#include <bitset>
#include <set>
#include <map>
#include <stdio.h>

#define rep(i,n) for (int i = 0; i < (n); i++)
#define FOR(i,a,b) for (int i=(a); i < (b); i++)
#define INF 100000000000
#define MOD 1000000007 //10^9+7
using namespace std;
using ll = long long;
using P = pair<int, int>;

// 負の数にも対応した % 演算
long long mod(long long val, long long m) {
    long long res = val % m;
    if (res < 0) res += m;
    return res;
}

int main()
{
    int a, b;
    cin >> a >> b;
    int ans = 0;
    for(int i = a; i <= b; i++) {
        if((i % 10 == i / 10000) && ((i/10) % 10 == (i/1000)%10)){
            ans++;
        }
    }

    cout << ans << endl;
    return 0;
}
//  [cpp]
#include <iostream>
#include <algorithm>
#include <queue>
#include <vector>
#include <string>
#define INF -1
using namespace std;

typedef long long int ll;
typedef pair<int, int> P;

int main() {

	int a, b;
	cin >> a >> b;
	int ans = 0;

	for (int i = 1; i <= 9; i++) {
		for (int k = 0; k <= 9; k++) {
			for (int j = 0; j <= 9; j++) {
				ll c = 10000 * i + 1000 * k + 100 * j + 10 * k + i;
					if (c >= a && c <= b) {
						ans += 1;
				}
			}
		}
	}

	cout << ans << endl;

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

int main(){
    int a,b,c;
    c=0;
    scanf("%d %d",&a,&b);
    for(int i=a;i<b+1;i++){
        if((i/10000)!=(i%10))continue;
        if(((i/1000)%10)!=((i/10)%10))continue;
        c++;
    }
    printf("%d\n",c);
    return 0;
}
//  [cpp]
#include<iostream>
#include<chrono>
using namespace std;

int main(void){
    chrono::system_clock::time_point start, end;
    start = chrono::system_clock::now();
    int A, B;
    cin >> A >> B;
    int a, b, c, d;
    double time{0};
    int sum{0};

    while(true){
        sum=0;
        for(int i{A}; i<=B; ++i){
            a = i/10000;
            b = i/1000%10;
            c = i/10%10;
            d = i%10;
            if(a==d and b==c)
                ++sum;
        }
        end  = chrono::system_clock::now();
        time =  static_cast<double>(chrono::duration_cast<chrono::microseconds>(end - start).count() / 1000.0);
        if(time>1998)
            break;
    }
    cout << sum << endl;

}
//  [cpp]
#include<iostream>
#include<chrono>
using namespace std;

int main(void){
    chrono::system_clock::time_point start, end;
    start = chrono::system_clock::now();
    int A, B;
    cin >> A >> B;
    int a, b, c, d;
    double time{0};
    int sum{0};

    while(true){
        sum=0;
        for(int i{A}; i<=B; ++i){
            a = i/10000;
            b = i/1000%10;
            c = i/10%10;
            d = i%10;
            if(a==d and b==c)
                ++sum;
        }
        end  = chrono::system_clock::now();
        time =  static_cast<double>(chrono::duration_cast<chrono::microseconds>(end - start).count() / 1000.0);
        if(time>1900)
            break;
    }
    cout << sum << endl;

}
//  [cpp]
#include<iostream>
#include<string>
#include<cstring>
#include<algorithm>
#include<vector>
#include<cmath>
#include<map>
#include<set>
#include<cstdio>
#define MAXA 100000
#define MAX 20000000000
#define s(i) scanf("%d", &(i))
#define p(i) printf("%d", (i))
#define ps() printf(" ") 
#define rer(i,j,k) for((i)=(j);(i)<(k);++(i))
#define ret(i,j,k) for((i)=(j);(i)>(k);--(i))
using namespace std;
int a1[MAXA] = {0}, a2[MAXA] = {0};
int main(){
	int a, b, c, i, j;
	int Count = 0;
	cin >> a >> b;
	for(i = a; i <= b; i++){
		int t = 0, is = 0, q;
		q = i;
		while(q){
			a1[t++] = q%10;
			q/=10;
		}
		for(j = 0; j < (t+1)/2; j++){
			if(a1[j]!=a1[t-1-j]){
				is = 1;
				break;
			}
		}
		if(!is){
			Count++;
		}
		memset(a1,0,sizeof(a1));
	}
	cout << Count << endl;
	return 0;
}
//  [c]
#include <stdio.h>

int main(){
  int A,B;
  scanf("%d%d", &A, &B);
  
  int count = 0;
  
  for(int i = A; i <= B; i++){
    if((i/10000) == (i%10)){ //万の位 = 一の位
      if((i/1000)%10 == (i/10)%10){ //千の位 = 十の位
        count++;
      }
    }
  }
  printf("%d",count);
}
//  [c]
#include<stdio.h>

int main(void)
{
    int a, b;
    int ans = 0;

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

    for (; a <= b; a++) {
        if ((a/10000 == a%10) && ((a%10000)/1000) == ((((a%10000)%1000)%100)/10)) {
            ans++;
        }
    }
    printf("%d\n", ans);
    return 0;
}
//  [c]
#include <stdio.h>
#include <math.h>

int main(void) {
	int a, b, i, j, c[5], temp, cnt = 0;
	
	scanf("%d %d", &a, &b);
	
	for (i = a; i <= b; i++) {
		temp = i;
		for (j = 4; j >= 0; j--) {
			c[j] = temp / (int)pow(10, j);
			temp = temp % (int)pow(10, j);
		}
		if (c[0] == c[4] && c[1] == c[3])
			cnt++;
	}
	
	printf("%d\n", cnt);
	
	return 0;
}
//  [c]
#include<stdio.h>
#include<math.h>

int main(void)
{
  int a,b;
  scanf("%d%d",&a,&b);

  int i,j,n,m,tmp,cnt=0;
  for(i=a;i<=b;i++){
    tmp = i;
    n = tmp;
    m = 0;
    for(j=1;j<6;j++){
      m += (tmp%10)*(int)pow(10,5-j);
      tmp /= 10;
    }


    if(n==m)
      cnt++;
  }

  printf("%d\n",cnt);
  return 0;
}
//  [c]
#include <stdio.h>
#include <math.h>
int main()
{
  int s,g,n,i,j,c;
  int number[5];
  scanf("%d" ,&s);
  scanf("%d",&g);
  c=0;
  while(s<=g){
    n=s;
    for(i=0;i<5;++i){
      j=pow(10,4-i);
      number[4-i]=n/j;
      n-=number[4-i]*j;
    }
    if(number[0]==number[4] && number[1]==number[3]) ++c;
    ++s;
  }
  printf("%d\n",c);
  return 0;
}
//  [javascript]
"use strict";

function main(input) {
  input = input.split(/\n|\s/).map(v => ~~v);
  const a = input[0];
  const b = input[1];

  let i = a;
  let ans = 0;
  while (i <= b) {
    if (
      Math.floor(i / 10000) === i % 10 &&
      Math.floor(i / 1000) % 10 === Math.floor(i / 10) % 10
    )
      ans++;

    i++;
  }
  console.log(ans);
}

main(require("fs").readFileSync("/dev/stdin", "utf8"));
//  [javascript]
function Main(input) {
	input = input.split(" ").map(a => parseInt(a));
	var A = input[0];
	var B = input[1];
	
	var ans = 0;
	for(;A<=B;A++){
		if(Math.floor(A / 10000) === A % 10 && Math.floor(A/1000) % 10 === Math.floor(A % 100 / 10)) ans++;
	}
	
	console.log(ans);
}

Main(require("fs").readFileSync("/dev/stdin", "utf8"));
//  [javascript]
function Main(input) {
  var inputs = input.split(" ");
  var a = parseInt(inputs[0], 10);
  var b = parseInt(inputs[1], 10);
  var cnt = 0;
  for ( a; a <= b; a++) {
    if (Math.floor(a / 10000) === a % 10 && Math.floor(a / 1000) % 10 === Math.floor(a / 10) % 10) {
      cnt++;
    }
  }
  console.log(cnt);
}

Main(require("fs").readFileSync("/dev/stdin", "utf8"));
//  [javascript]
function Main(input) {
    var input = input.split(' ');
    var A = input[0];
    var B = input[1];
    var cnt = 0;
    function hoge(){
        var x = A.toString();
        if(x[0] === x[4] && x[1] === x[3]){
            return true;
        }
    }
    while(A <= B) {
     if(hoge()) {
            cnt++;
        }
    A++;
    }
    console.log(cnt);
    }
Main(require('fs').readFileSync('/dev/stdin', 'utf8'));
//  [javascript]
function Main(input) {
    var input = input.split(' ');
    var A = parseInt(input[0], 10);
    var B = parseInt(input[1], 10);
    var cnt = 0;
    for(a = 1; a <= 9; a++) {
        for(b = 0; b <= 9; b++)  {
            for(c = 0; c <= 9; c++) {
                var x = 10001 * a + 1010 * b + 100 * c;
                if (A <= x && x <= B) {
                    cnt++;
                }
            }
        }
    }
    console.log(cnt);
    }
Main(require('fs').readFileSync('/dev/stdin', 'utf8'));
//  [go]
package main

import (
	"fmt"
)

func main() {
	var a, b int
	fmt.Scan(&a, &b)
	count := 0

	for i := a; i <= b; i++ {
		if i/10000 == i%10 {
			if (i/1000)%10 == (i%100)/10 {
				count++
			}
		}
	}
	fmt.Println(count)
}