#![allow(unused_imports)]
#![allow(dead_code)]
use datastructure::*;
use input_scanner::*;

use std::cmp;
use std::collections::{BTreeMap, BTreeSet, BinaryHeap, HashMap, HashSet, LinkedList, VecDeque};

fn main() {
    let mut scan = Scanner::new();
    let n: usize = scan.next();
    let mut bset: BTreeSet<i32> = BTreeSet::new();

    for _ in 0..n {
        let a: i32 = scan.next();
        bset.insert(a);
    }
    println!("{}", if bset.len() == n {"YES"} else {"NO"});
}

mod datastructure {}
mod input_scanner {
    pub struct Scanner {
        bytes: Vec<u8>,
        begin: usize,
        end: usize,
    }

    impl Scanner {
        pub fn new() -> Self {
            use std::io::Read;
            let mut buffer: Vec<u8> = Vec::new();
            std::io::stdin().read_to_end(&mut buffer).unwrap();
            let end = (0..buffer.len())
                .find(|i| buffer[*i].is_ascii_whitespace())
                .unwrap_or(buffer.len());
            Scanner {
                bytes: buffer,
                begin: 0,
                end: end,
            }
        }
        pub fn next<T: std::str::FromStr>(&mut self) -> T {
            let s: &str = unsafe { std::str::from_utf8_unchecked(&self.bytes[self.begin..self.end]) };
            let ret: T = s.parse::<T>().ok().expect("Parse error.");
            self.skip();
            ret
        }
        pub fn next_vec<T: std::str::FromStr>(&mut self, n: usize) -> Vec<T> {
            (0..n).map(|_| self.next()).collect()
        }
        pub fn next_word(&mut self) -> Vec<u8> {
            let r = Vec::from(&self.bytes[self.begin..self.end]);
            self.skip();
            r
        }
        fn skip(&mut self) {
            self.begin = (self.end..self.bytes.len())
                .find(|i| !self.bytes[*i].is_ascii_whitespace())
                .unwrap_or(self.bytes.len());
            self.end = (self.begin..self.bytes.len())
                .find(|i| self.bytes[*i].is_ascii_whitespace())
                .unwrap_or(self.bytes.len());
        }
    }
}


#![allow(unused_macros, deprecated)]

#[allow(dead_code)]
mod utils {
    use std::io::{
        self, BufRead, BufReader, BufWriter, Seek, SeekFrom, Stdin, StdinLock, Stdout, StdoutLock,
        Write,
    };
    use std::mem;
    use std::ops::{Deref, DerefMut};
    use std::ptr;
    use std::slice;
    use std::str::{self, FromStr};

    #[inline]
    fn is_space_or_line_break(b: &u8) -> bool {
        *b == b' ' || *b == b'\n'
    }

    pub struct Scanner<R: BufRead> {
        reader: R,
        buf: Vec<u8>,
    }

    impl<R: BufRead> Scanner<R> {
        #[inline]
        pub fn new(reader: R) -> Scanner<R> {
            Scanner {
                reader: reader,
                buf: Vec::with_capacity(100),
            }
        }

        pub fn read<T: FromStr>(&mut self) -> T {
            self.read_until(is_space_or_line_break);
            self.parse()
        }

        pub fn read2<T1: FromStr, T2: FromStr>(&mut self) -> (T1, T2) {
            (self.read(), self.read())
        }

        pub fn read3<T1: FromStr, T2: FromStr, T3: FromStr>(&mut self) -> (T1, T2, T3) {
            (self.read(), self.read(), self.read())
        }

        pub fn read4<T1: FromStr, T2: FromStr, T3: FromStr, T4: FromStr>(
            &mut self,
        ) -> (T1, T2, T3, T4) {
            (self.read(), self.read(), self.read(), self.read())
        }

        pub fn reads(&mut self) -> &str {
            self.read_until(is_space_or_line_break);
            unsafe { str::from_utf8_unchecked(&self.buf) }
        }

        pub fn readl(&mut self) -> &str {
            self.buf.clear();
            self.reader.read_until(b'\n', &mut self.buf).unwrap();
            let bytes = if self.buf.last() == Some(&b'\n') {
                &self.buf[..self.buf.len() - 1]
            } else {
                &self.buf
            };
            unsafe { str::from_utf8_unchecked(&bytes) }
        }

        pub fn read_vec<T: FromStr>(&mut self, count: usize) -> Vec<T> {
            (0..count).map(|_| self.read()).collect()
        }

        fn read_until<P: FnMut(&u8) -> bool>(&mut self, mut predicate: P) {
            self.buf.clear();
            let mut first = true;

            // https://doc.rust-lang.org/src/std/io/mod.rs.html#1623-1649
            loop {
                let (done, used) = {
                    let available = self.reader.fill_buf().unwrap();
                    if first && available.len() == 0 {
                        panic!("Scan Error (EOF reached)");
                    }

                    match available.iter().position(&mut predicate) {
                        Some(0) if first => (false, 1),
                        Some(i) => {
                            self.buf.extend_from_slice(&available[..i]);
                            (true, i + 1)
                        }
                        None => {
                            self.buf.extend_from_slice(available);
                            (false, available.len())
                        }
                    }
                };

                self.reader.consume(used);
                if done || used == 0 {
                    return;
                }

                first = false;
            }
        }

        #[inline]
        fn parse<T: FromStr>(&mut self) -> T {
            // 文字列をT型へパースする
            let elem = unsafe { str::from_utf8_unchecked(&self.buf) };
            elem.parse()
                .unwrap_or_else(|_| panic!(format!("failed parsing: {}", elem)))
        }
    }

    impl<R: BufRead + Seek> Seek for Scanner<R> {
        #[inline]
        fn seek(&mut self, pos: SeekFrom) -> io::Result<u64> {
            self.reader.seek(pos)
        }
    }

    pub struct StdinScanner {
        stdin: Stdin,
        scanner: Scanner<BufReader<StdinLock<'static>>>,
    }

    impl StdinScanner {
        #[inline]
        pub fn new() -> StdinScanner {
            let stdin = io::stdin();
            let stdinlock = unsafe { mem::transmute(stdin.lock()) };
            let reader = BufReader::with_capacity(4096, stdinlock);
            let scanner = Scanner::new(reader);
            StdinScanner {
                stdin: stdin,
                scanner: scanner,
            }
        }
    }

    impl Deref for StdinScanner {
        type Target = Scanner<BufReader<StdinLock<'static>>>;

        #[inline]
        fn deref(&self) -> &Self::Target {
            &self.scanner
        }
    }

    impl DerefMut for StdinScanner {
        #[inline]
        fn deref_mut(&mut self) -> &mut Self::Target {
            &mut self.scanner
        }
    }

    pub struct StdoutWriter {
        stdout: Stdout,
        writer: BufWriter<StdoutLock<'static>>,
    }

    impl StdoutWriter {
        #[inline]
        pub fn new() -> StdoutWriter {
            let stdout = io::stdout();
            let stdoutlock = unsafe { mem::transmute(stdout.lock()) };
            let writer = BufWriter::with_capacity(4096, stdoutlock);
            StdoutWriter {
                stdout: stdout,
                writer: writer,
            }
        }

        pub fn write<T: Writable>(&mut self, v: T) {
            v.display(&mut self.writer);
        }

        pub fn writeln<T: Writable>(&mut self, v: T) {
            v.display(&mut self.writer);
            self.writer.write_all(b"\n").unwrap();
        }

        pub fn write_horizontal<I>(&mut self, iter: I)
        where
            I: IntoIterator,
            I::Item: Writable,
        {
            let mut it = iter.into_iter();
            if let Some(elem) = it.next() {
                elem.display(&mut self.writer);
            } else {
                return;
            }

            for elem in it {
                elem.display(&mut self.writer);
                self.writer.write_all(b" ").unwrap();
            }
        }

        pub fn write_vertical<I>(&mut self, iter: I)
        where
            I: IntoIterator,
            I::Item: Writable,
        {
            let mut it = iter.into_iter();
            if let Some(elem) = it.next() {
                elem.display(&mut self.writer);
            } else {
                return;
            }

            for elem in it {
                elem.display(&mut self.writer);
                self.writer.write_all(b"\n").unwrap();
            }
        }
    }

    impl Write for StdoutWriter {
        #[inline]
        fn flush(&mut self) -> io::Result<()> {
            self.writer.flush()
        }

        #[inline]
        fn write(&mut self, buf: &[u8]) -> io::Result<usize> {
            self.writer.write(buf)
        }
    }

    static DEC_DIGITS_LUT: &'static [u8; 200] = b"0001020304050607080910111213141516171819\
            2021222324252627282930313233343536373839\
            4041424344454647484950515253545556575859\
            6061626364656667686970717273747576777879\
            8081828384858687888990919293949596979899";

    fn write_int<W: Write>(mut writer: W, mut n: u64, is_negative: bool) {
        unsafe {
            let mut buf: [u8; 39] = mem::uninitialized();
            let buf_ptr_start = buf.as_mut_ptr().offset(39);
            let mut buf_ptr = buf_ptr_start;
            let lut_ptr = DEC_DIGITS_LUT.as_ptr();

            while n >= 10000 {
                let rem = (n % 10000) as isize;
                n /= 10000;

                let d1 = (rem / 100) << 1;
                let d2 = (rem % 100) << 1;
                buf_ptr = buf_ptr.offset(-4);
                ptr::copy_nonoverlapping(lut_ptr.offset(d1), buf_ptr, 2);
                ptr::copy_nonoverlapping(lut_ptr.offset(d2), buf_ptr.offset(2), 2);
            }

            let mut n = n as isize; // possibly reduce 64bit math

            // decode 2 more chars, if > 2 chars
            if n >= 100 {
                let d1 = (n % 100) << 1;
                n /= 100;
                buf_ptr = buf_ptr.offset(-2);
                ptr::copy_nonoverlapping(lut_ptr.offset(d1), buf_ptr, 2);
            }

            // decode last 1 or 2 chars
            if n < 10 {
                buf_ptr = buf_ptr.offset(-1);
                *buf_ptr = (n as u8) + b'0';
            } else {
                let d1 = n << 1;
                buf_ptr = buf_ptr.offset(-2);
                ptr::copy_nonoverlapping(lut_ptr.offset(d1), buf_ptr, 2);
            }

            if is_negative {
                buf_ptr = buf_ptr.offset(-1);
                *buf_ptr = b'-';
            }

            let buf_slice =
                slice::from_raw_parts(buf_ptr, buf_ptr_start as usize - buf_ptr as usize);

            writer.write_all(buf_slice).unwrap();
        }
    }

    pub trait Writable {
        fn display<W: Write>(&self, writer: &mut W);
    }

    impl Writable for str {
        #[inline]
        fn display<W: Write>(&self, writer: &mut W) {
            writer.write_all(self.as_bytes()).unwrap()
        }
    }

    impl<'a> Writable for &'a str {
        #[inline]
        fn display<W: Write>(&self, writer: &mut W) {
            writer.write_all(self.as_bytes()).unwrap()
        }
    }

    impl Writable for String {
        #[inline]
        fn display<W: Write>(&self, writer: &mut W) {
            writer.write_all(self.as_bytes()).unwrap()
        }
    }

    impl Writable for bool {
        #[inline]
        fn display<W: Write>(&self, writer: &mut W) {
            let s: &'static [u8] = if *self { b"Yes" } else { b"No" };
            writer.write_all(s).unwrap();
        }
    }

    macro_rules! impl_writable_int {
        ($($int:ty)*) => {
            $(
                impl Writable for $int {
                    #[allow(unused_comparisons)]
                    fn display<W: Write>(&self, writer: &mut W) {
                        let is_negative = !(*self >= 0);
                        let abs = if is_negative {
                            (!*self as u64).wrapping_add(1)
                        } else {
                            *self as u64
                        };
                        write_int(writer, abs, is_negative);
                    }
                }
            )*
        };
    }

    macro_rules! impl_writable_float {
        ($($float:ty)*) => {
            $(
                impl Writable for $float {
                    #[inline]
                    fn display<W: Write>(&self, writer: &mut W) {
                        write!(writer, "{}", *self).unwrap();
                    }
                }
            )*
        }
    }

    impl_writable_int!(u8 u16 u32 u64 usize i8 i16 i32 i64 isize);
    impl_writable_float!(f32 f64);

    pub static mut SCANNER: *mut StdinScanner = 0 as *mut StdinScanner;
    pub static mut WRITER: *mut StdoutWriter = 0 as *mut StdoutWriter;

    #[inline]
    pub fn atcoder_initialize() {
        unsafe {
            SCANNER = mem::transmute(Box::new(StdinScanner::new()));
            WRITER = mem::transmute(Box::new(StdoutWriter::new()));
        }
    }

    #[inline]
    pub fn atcoder_finish() {
        unsafe {
            (*WRITER).flush().unwrap();
        }
    }

    #[macro_export]
    macro_rules! input {
        () => {};
        (@scanner $scanner:ident, @pred [ $($pred:tt)* ], $var:tt : $t:tt) => {
            let $($pred)* $var = scan!($scanner, $t);
        };
        (@scanner $scanner:ident,) => {};
        (@scanner $scanner:ident, $var:tt : $t:tt) => {
            input!(@scanner $scanner, @pred [], $var : $t);
        };
        (@scanner $scanner:ident, mut $var:tt : $t:tt) => {
            input!(@scanner $scanner, @pred [mut], $var : $t);
        };
        (@scanner $scanner:ident, $var:tt : $t:tt, $($r:tt)*) => {
            input!(@scanner $scanner, $var : $t);
            input!(@scanner $scanner, $($r)*);
        };
        (@scanner $scanner:ident, mut $var:tt : $t:tt, $($r:tt)*) => {
            input!(@scanner $scanner, mut $var : $t);
            input!(@scanner $scanner, $($r)*);
        };
        ($($r:tt)*) => {
            let scanner_ref = unsafe { &mut *$crate::utils::SCANNER };
            input!(@scanner scanner_ref, $($r)*);
        }
    }

    #[macro_export]
    macro_rules! scan {
        ($scanner:ident, [ $t:tt ; $len:expr ]) => {
            (0..$len).map(|_| scan!($scanner; $t)).collect::<Vec<_>>()
        };
        ($scanner:ident, usize1) => {
            scan!($scanner; usize) - 1
        };
        ($scanner:ident, line) => {
            $scanner.readl().to_string()
        };
        ($scanner:ident, $t:ty) => {
            $scanner.read::<$t>()
        };
    }

    #[macro_export]
    macro_rules! pprint {
        ($value:expr) => {
            unsafe {
                (*$crate::utils::WRITER).write($value);
            }
        };
        ($value:expr, $($r:tt)*) => {
            let writer = unsafe { &*$crate::utils::WRITER };
            writer.write($value);
            writer.write(" ");
            pprint!($($r)*);
        };
    }

    #[macro_export]
    macro_rules! pprintln {
        ($value:expr) => {
            unsafe {
                (*$crate::utils::WRITER).writeln($value);
            }
        };
        ($value:expr, $($r:tt)*) => {
            let writer = unsafe { &*$crate::utils::WRITER };
            writer.write($value);
            writer.write(" ");
            pprintln!($($r)*);
        };
    }

    #[macro_export]
    macro_rules! atcoder_main {
        ($func:ident) => {
            fn main() {
                $crate::utils::atcoder_initialize();
                $func();
                $crate::utils::atcoder_finish();
            }
        };
    }
}

use std::collections::HashSet;

fn run() {
    input! {
        _: usize,
        a: line,
    }

    let mut visited = HashSet::<&str>::new();

    for ai in a.split(' ') {
        if !visited.insert(ai) {
            pprintln!("NO");
            return;
        }
    }

    pprintln!("YES");
}

atcoder_main!(run);


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: usize = read();
    let a: Vec<i64> = read_n(n);
    let mut b: Vec<bool> = vec![false; 1_000_000_000];
    let mut ans: String = "YES".to_string();

    for i in 0..a.len() {
        let ai = a[i];
        if b[ai] == false {
            b[ai] = true;
        } else {
            ans = "NO";
            break;
        }
    }

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


// 🐋💭
import Foundation

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

func main() {
    let n = Int(readLine()!)!
    var aryA = readInts()
    //_________________________ここまで入力
    aryA.sort()
    for i in 0..<n-1 {
        if aryA[i] == aryA[i+1] {
            print("NO")
            return
        }
    }
    print("YES")
}

main()


import Foundation

let N = Int(readLine()!)!
var array =  readLine()!.componentsSeparatedByString(" ").map { Int($0)! }
var answer = "YES"
array = array.sort()
for i in 0 ..< N - 1 {
  	let diff = array[i] - array[i + 1]
    if  diff == 0 {
        answer = "NO"
    }
}
print(answer)


// 🐋💭
import Foundation

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

func main() {
    let n = Int(readLine()!)!
    var aryA = readInts()
    //_________________________ここまで入力
    aryA.sort()
    for i in 0..<n-1 {
        if aryA[i] == aryA[i+1] {
            print("No")
            return
        }
    }
    print("Yes")
}

main()


import Foundation

let N = Int(readLine()!)!
var array =  readLine()!.componentsSeparatedByString(" ").map { Int($0)! }
var answer = "YES"
_ = array.map {
    //array.remove(value: $0)
	if let i = array.indexOf($0) {
        array.removeAtIndex(i)
    }
    if array.contains($0) {
        answer = "NO"
    }
}
print(answer)


import Foundation

extension Array where Element: Equatable {
    mutating func remove(value: Element) {
        if let i = self.indexOf(value) {
//        if let i = self.firstIndex(of: value) {
            self.removeAtIndex(i)
        }
    }
}

let N = Int(readLine()!)!
//var array =  [1,1,1]
var array =  readLine()!.componentsSeparatedByString(" ").map { Int($0)! }
var answer = "YES"
_ = array.map {
    //array.remove(value: $0)
	if let i = array.indexOf($0) {
        array.removeAtIndex(i)
    }
    if array.contains($0) {
        answer = "NO"
    }
}
print(answer)


import * as fs from "fs";

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

const arr = lines[1].split(' ').map(Number)

const set = new Set(arr)

console.log(arr.length === set.size ? 'YES' : 'NO')


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[]{
    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):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{
    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{
    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));
  };
}
const main = () => {
  const o = new AtCoder()
  let obj ={}
  let n=o.n()
  for(let i=0;i<n;i++){
    let s=o.s()
    if(obj[s]){
      o.o('NO')
      return
    }
    obj[s]=1;
  }
  o.o('YES')
}
main();


import * as fs from "fs";

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

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

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

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

a.sort(compareFunc);
let ans: string = 'YES';
for (let i = 0; i < n-1; i++){
    if (a[i] === a[i+1]){
        ans = 'NO';
    }
}

console.log(ans);


const main = (input: string) => {
  const lines = input.trim().split("\n")
  const N = parseInt(lines[0])
  const A = lines[1].split(" ").map(str => parseInt(str))

  const removeDuplicates = A.filter((x, i, self) => {
    return self.indexOf(x) === i
  })

  let answer = "NO"
  if(removeDuplicates.length === A.length) {
    answer = "YES"
  }

  console.log(answer)
}

main(require('fs').readFileSync('/dev/stdin', 'utf8'));


import * as fs from 'fs';

const [n, as] = fs.readFileSync("/dev/stdin", "utf8").split("\n")
const uniq = [...new Set(as.split(" "))]
console.log(uniq.length === +n ? "YES" : "NO")


import * as fs from 'fs';

const input = fs.readFileSync("/dev/stdin", "utf8")
const nums = input.split("\n")[1].split(" ")
const unique = nums.filter((v, i, self) => self.indexOf(v) === i)
console.log(unique.length === nums.length ? "YES" : "NO")


s=input()
ans=1000
for i in range(len(s)-2):
    ans=min(ans,abs(753-int(s[i:i+3])))

print(ans)


s=input()
l=len(s)
min=1000
for i in range(l-2):
    num=s[i]+s[i+1]+s[i+2]
    num2=abs(753-eval(num))
    if num2<min:
        min=num2
print(min)


S = input()
ans = 99999
for i in range(len(S) - 2):
    a = int(S[i:i+3])
    ans = min(ans, abs(a-753))
print(ans)


S = input()
min = 1000
for i in range(len(S) - 2):
	x = int(S[i:i+3])
	print(x)
	x = abs(753 - x)
	if min > x:
		min = x
print(min)


s = input()

arr = []

for i in range(0, len(s) - 2):
    arr.append(753 - int(str(s[i]) + str(s[i + 1]) + str(s[i + 2])))

print(min(arr))


table = list(map(int, input()))
diff_nagomi = 1000
for i in range(len(table)-2):
    diff = abs(table[i] * 100 + table[i + 1] * 10 + table[i + 2] - 753)
    if diff_nagomi > diff:
        ans = diff
print(ans)


//提出は以下
import java.io.*;
import java.io.IOException;
import java.util.*;

public class Main {

    void submit() {

        String s = nextString();

        int min = 1000;
        int ans = 0;
        for(int i = 0;i < s.length()-2;i++){
            int temp = ctoi(s.charAt(i))*100 +ctoi(s.charAt(i+1))*10 + ctoi(s.charAt(i+2));
//            System.out.println(temp);
            if(Math.abs(753 - temp) < min){
                min = Math.abs(753-temp);
                ans = temp;
            }
        }
        out.println(min);
    }

    void test() {

    }

    public static int ctoi(char c) {
        switch (c) {
            case '0': return 0;
            case '1': return 1;
            case '2': return 2;
            case '3': return 3;
            case '4': return 4;
            case '5': return 5;
            case '6': return 6;
            case '7': return 7;
            case '8': return 8;
            case '9': return 9;
            default: return 0;
        }
    }

    Main() throws IOException {
        is = System.in;
        out = new PrintWriter(System.out);
        submit();
        // stress();
        // test();
        out.close();
    }

    public static void main(String[] args) throws IOException {
        new Main();
    }

    private InputStream is;
    PrintWriter out;

    private byte[] buf = new byte[1 << 14];
    private int bufSz = 0, bufPtr = 0;

    private int readByte() {
        if (bufSz == -1)
            throw new RuntimeException("Reading past EOF");
        if (bufPtr >= bufSz) {
            bufPtr = 0;
            try {
                bufSz = is.read(buf);
            } catch (IOException e) {
                throw new RuntimeException(e);
            }
            if (bufSz <= 0)
                return -1;
        }
        return buf[bufPtr++];
    }

    private boolean isTrash(int c) {
        return c < 33 || c > 126;
    }

    private int skip() {
        int b;
        while ((b = readByte()) != -1 && isTrash(b))
            ;
        return b;
    }

    String nextToken() {
        int b = skip();
        StringBuilder sb = new StringBuilder();
        while (!isTrash(b)) {
            sb.appendCodePoint(b);
            b = readByte();
        }
        return sb.toString();
    }

    String nextString() {
        int b = readByte();
        StringBuilder sb = new StringBuilder();
        while (!isTrash(b) || b == ' ') {
            sb.appendCodePoint(b);
            b = readByte();
        }
        return sb.toString();
    }

    double nextDouble() {
        return Double.parseDouble(nextToken());
    }

    char nextChar() {
        return (char) skip();
    }

    int nextInt() {
        int ret = 0;
        int b = skip();
        if (b != '-' && (b < '0' || b > '9')) {
            throw new InputMismatchException();
        }
        boolean neg = false;
        if (b == '-') {
            neg = true;
            b = readByte();
        }
        while (true) {
            if (b >= '0' && b <= '9') {
                ret = ret * 10 + (b - '0');
            } else {
                if (b != -1 && !isTrash(b)) {
                    throw new InputMismatchException();
                }
                return neg ? -ret : ret;
            }
            b = readByte();
        }
    }

    long nextLong() {
        long ret = 0;
        int b = skip();
        if (b != '-' && (b < '0' || b > '9')) {
            throw new InputMismatchException();
        }
        boolean neg = false;
        if (b == '-') {
            neg = true;
            b = readByte();
        }
        while (true) {
            if (b >= '0' && b <= '9') {
                ret = ret * 10 + (b - '0');
            } else {
                if (b != -1 && !isTrash(b)) {
                    throw new InputMismatchException();
                }
                return neg ? -ret : ret;
            }
            b = readByte();
        }
    }
}
//ここま


import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.IOException;

public class Main {
    public static void main(String[] args) throws IOException {
    	BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
    	String s = br.readLine();
    	br.close();
	int rgd = 999;
	int sft = 753;
    	for (int i=0;i<s.length()-2;i++) {
	    int sub = Integer.parseInt(s.substring(i,i+3));
	    if (Math.abs(sft-sub) < rgd) {
		rgd = (int)Math.abs(sft-sub);
	    }
	}
	System.out.println(rgd);
    }
}


import java.util.*;
import java.io.*;
import java.lang.reflect.Array;

public class Main {
	public static void main(String[] args) {
		FastReader r = new FastReader();
		String s = r.str();
		int min = Integer.MAX_VALUE;
		for(int i = 2; i<s.length(); i++) {
			int c = Integer.parseInt(s.substring(i-2, i+1));
			min = Math.min(min, Math.abs(753-c));
		}
		print(min);
	}

	public static boolean emptyRow(String[] m, int row, int col) {
		for(int c = 0; c<m[0].length(); c++)
			if(m[row].charAt(c) == '#')
				return false;
		return true;
	}

	public static boolean emptyCol(String[] m, int row, int col) {
		for(int r = 0; r<m.length; r++)
			if(m[r].charAt(col) == '#')
				return false;
		return true;
	}

	public static String repeat(String s, int n) {
		return String.join("", Collections.nCopies(n, s));
	}
	public static int getDigitSum(int n) {
		String str = ""+n;
		int sum = 0;
		for(int i = 0; i<str.length();i++) {
			sum += Integer.parseInt(""+str.charAt(i));
		}
		return sum;
	}

	public static void rolling(int[] arr) {
		if (arr.length < 2)
			return;
		for (int i = 1; i < arr.length; i++)
			arr[i] += arr[i - 1];
	}

	public static void rolling(long[] arr) {
		if (arr.length < 2)
			return;
		for (int i = 1; i < arr.length; i++)
			arr[i] += arr[i - 1];
	}

	public static void reverse(int[] arr) {
		for (int i = 0; i < arr.length / 2; i++) {
			int temp = arr[i];
			arr[i] = arr[arr.length - 1 - i];
			arr[arr.length - 1 - i] = temp;
		}
	}

	public static void swap(int[] arr, int pos1, int pos2) {
		int temp = arr[pos1];
		arr[pos1] = arr[pos2];
		arr[pos2] = temp;
	}
	public static void swap(long[] arr, int pos1, int pos2) {
		long temp = arr[pos1];
		arr[pos1] = arr[pos2];
		arr[pos2] = temp;
	}

	public static String al(String s) {
		return s + "\n";
	}

	public static void print(String s) {
		System.out.println(s);
	}

	public static void print(long s) {
		System.out.println(s);
	}

	public static void print(int s) {
		System.out.println(s);
	}

	public static void print(double s) {
		System.out.println(s);
	}

	static class FastReader {
		BufferedReader br;
		StringTokenizer st;

		public FastReader() {
			br = new BufferedReader(new InputStreamReader(System.in));
		}

		int ri() {
			return Integer.parseInt(str());
		}

		long rl() {
			return Long.parseLong(str());
		}

		double rd() {
			return Double.parseDouble(str());
		}

		String str() {
			String str = "";
			try {
				str = br.readLine();
			} catch (IOException e) {
				e.printStackTrace();
			}
			return str;
		}

		String[] rsa() {
			return str().split(" ");
		}

		int[] ria() {
			String[] s = rsa();
			int[] arr = new int[s.length];
			for (int i = 0; i < arr.length; i++)
				arr[i] = Integer.parseInt(s[i]);
			return arr;
		}

		long[] rla() {
			String[] s = rsa();
			long[] arr = new long[s.length];
			for (int i = 0; i < arr.length; i++)
				arr[i] = Long.parseLong(s[i]);
			return arr;
		}

		char[] rca() {
			String s = str();
			char[] arr = new char[s.length()];
			for (int i = 0; i < arr.length; i++)
				arr[i] = s.charAt(i);
			return arr;
		}

		String[] rsaml(int m) {
			String[] arr = new String[m];
			for (int i = 0; i < arr.length; i++)
				arr[i] = str();
			return arr;
		}

		int[] riaml(int m) {
			int[] arr = new int[m];
			for (int i = 0; i < arr.length; i++)
				arr[i] = Integer.parseInt(str());
			return arr;
		}

		long[] rlaml(int m) {
			long[] arr = new long[m];
			for (int i = 0; i < arr.length; i++)
				arr[i] = Long.parseLong(str());
			return arr;
		}
	}
}

class Node {
	public int val;
	public boolean visited;
	public Node(int v) { val=v; }
}


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

public class Main {
	static void solve() {
		String s = ns();
		int n = s.length();
		int d = inf;
		for(int i=0;i<n-3;i++) {
			int res = Integer.valueOf(s.substring(i,i+3));
			if(Math.abs(res - 753) < d) {
				d = Math.abs(res - 753);
			}
		}
		out.println(d);
	}

	//constants
	static final int inf = Integer.MAX_VALUE / 2;
	static final long linf = Long.MAX_VALUE / 3;
	static final double dinf = Double.MAX_VALUE / 3;
	static final long mod = (long) 1e9 + 7;
	static final int[] dx = { -1, 0, 1, 0 }, dy = { 0, -1, 0, 1 }, dx8 = { -1, -1, -1, 0, 0, 1, 1, 1 }, dy8 = { -1, 0, 1, -1, 1, -1, 0, 1 };
	static final double eps = 1e-10;

	//libraries
	static long[] cum(int a[]) {
		long[] cum = new long[a.length + 1];
		for(int i=0;i<a.length;i++) cum[i+1] = cum[i] + a[i];
		return cum;
	}
	static long[] cum(long a[]) {
		long[] cum = new long[a.length + 1];
		for(int i=0;i<a.length;i++) cum[i+1] = cum[i] + a[i];
		return cum;
	}
	static void reverse(int ar[]) {
		int len = ar.length;
		for (int i = 0; i < len / 2; i++) {
			int t = ar[i];
			ar[i] = ar[len - 1 - i];
			ar[len - 1 - i] = t;
		}
	}
	static void reverse(long ar[]) {
		int len = ar.length;
		for (int i = 0; i < len / 2; i++) {
			long t = ar[i];
			ar[i] = ar[len - 1 - i];
			ar[len - 1 - i] = t;
		}
	}
	static void reverse(double ar[]) {
		int len = ar.length;
		for (int i = 0; i < len / 2; i++) {
			double t = ar[i];
			ar[i] = ar[len - 1 - i];
			ar[len - 1 - i] = t;
		}
	}
	static void reverse(char ar[]) {
		int len = ar.length;
		for (int i = 0; i < len / 2; i++) {
			char t = ar[i];
			ar[i] = ar[len - 1 - i];
			ar[len - 1 - i] = t;
		}
	}
	static String getReverse(String s) {
		StringBuilder sb = new StringBuilder(s);
		return sb.reverse().toString();
	}
	static <T> void reverse(T[] ar) {
		int len = ar.length;
		for (int i = 0; i < len / 2; i++) {
			T t = ar[i];
			ar[i] = ar[len - 1 - i];
			ar[len - 1 - i] = t;
		}
	}
	static int[] concat(int x, int arr[]) {
		int ret[] = new int[arr.length + 1];
		System.arraycopy(arr, 0, ret, 1, ret.length - 1);
		ret[0] = x;
		return ret;
	}
	static int[] concat(int arr[], int x) {
		int ret[] = new int[arr.length + 1];
		System.arraycopy(arr, 0, ret, 0, ret.length - 1);
		ret[ret.length - 1] = x;
		return ret;
	}
	static long[] concat(long x, long arr[]) {
		long ret[] = new long[arr.length + 1];
		System.arraycopy(arr, 0, ret, 1, ret.length - 1);
		ret[0] = x;
		return ret;
	}
	static long[] concat(long arr[], long x) {
		long ret[] = new long[arr.length + 1];
		System.arraycopy(arr, 0, ret, 0, ret.length - 1);
		ret[ret.length - 1] = x;
		return ret;
	}
	static char[] concat(char x, char arr[]) {
		char ret[] = new char[arr.length + 1];
		System.arraycopy(arr, 0, ret, 0, ret.length - 1);
		ret[ret.length - 1] = x;
		return ret;
	}
	static char[] concat(char arr[], char x) {
		char ret[] = new char[arr.length + 1];
		System.arraycopy(arr, 0, ret, 0, ret.length - 1);
		ret[ret.length - 1] = x;
		return ret;
	}
	static int max(int x, int y) {
		return Math.max(x, y);
	}
	static int min(int x, int y) {
		return Math.min(x, y);
	}
	static int max(int x, int y, int z) {
		x = Math.max(x, y);
		x = Math.max(x, z);
		return x;
	}
	static int min(int x, int y, int z) {
		x = Math.min(x, y);
		x = Math.min(x, z);
		return x;
	}
	static long max(long x, long y) {
		return Math.max(x, y);
	}
	static long min(long x, long y) {
		return Math.min(x, y);
	}
	static long max(long x, long y, long z) {
		x = Math.max(x, y);
		x = Math.max(x, z);
		return x;
	}
	static long min(long x, long y, long z) {
		x = Math.min(x, y);
		x = Math.min(x, z);
		return x;
	}
	static double max(double x, double y) {
		return Math.max(x, y);
	}
	static double min(double x, double y) {
		return Math.min(x, y);
	}
	static double max(double x, double y, double z) {
		x = Math.max(x, y);
		x = Math.max(x, z);
		return x;
	}
	static double min(double x, double y, double z) {
		x = Math.min(x, y);
		x = Math.min(x, z);
		return x;
	}
	static void sort(int[] ar) {
		Arrays.sort(ar);
	}
	static void sort(long[] ar) {
		Arrays.sort(ar);
	}
	static void sort(double[] ar) {
		Arrays.sort(ar);
	}
	static void sort(char[] ar) {
		Arrays.sort(ar);
	}
	static void rsort(int[] ar) {
		Arrays.sort(ar);
		int len = ar.length;
		for (int i = 0; i < len / 2; i++) {
			int tmp = ar[i];
			ar[i] = ar[len - 1 - i];
			ar[len - 1 - i] = tmp;
		}
	}
	static void rsort(long[] ar) {
		Arrays.sort(ar);
		int len = ar.length;
		for (int i = 0; i < len / 2; i++) {
			long tmp = ar[i];
			ar[i] = ar[len - 1 - i];
			ar[len - 1 - i] = tmp;
		}
	}
	static void rsort(double[] ar) {
		Arrays.sort(ar);
		int len = ar.length;
		for (int i = 0; i < len / 2; i++) {
			double tmp = ar[i];
			ar[i] = ar[len - 1 - i];
			ar[len - 1 - i] = tmp;
		}
	}
	static void rsort(char[] ar) {
		Arrays.sort(ar);
		int len = ar.length;
		for (int i = 0; i < len / 2; i++) {
			char tmp = ar[i];
			ar[i] = ar[len - 1 - i];
			ar[len - 1 - i] = tmp;
		}
	}
	static void fill(int arr[], int x) {
		Arrays.fill(arr, x);
	}
	static void fill(long arr[], long x) {
		Arrays.fill(arr, x);
	}
	static void fill(boolean arr[], boolean x) {
		Arrays.fill(arr, x);
	}
	static void fill(double arr[], double x) {
		Arrays.fill(arr, x);
	}
	static void fill(int arr[][], int x) {
		for (int i = 0; i < arr.length; i++)
			Arrays.fill(arr[i], x);
	}
	static void fill(long arr[][], long x) {
		for (int i = 0; i < arr.length; i++)
			Arrays.fill(arr[i], x);
	}
	static void fill(double arr[][], double x) {
		for (int i = 0; i < arr.length; i++)
			Arrays.fill(arr[i], x);
	}
	static void fill(boolean arr[][], boolean x) {
		for (int i = 0; i < arr.length; i++)
			Arrays.fill(arr[i], x);
	}
	//MOD culc
	static long plus(long x, long y) {
		long res = (x + y) % mod;
		return res < 0 ? res + mod : res;
	}
	static long sub(long x, long y) {
		long res = (x - y) % mod;
		return res < 0 ? res + mod : res;
	}
	static long mul(long x, long y) {
		long res = (x * y) % mod;
		return res < 0 ? res + mod : res;
	}
	static long div(long x, long y) {
		long res = x * pow(y, mod - 2) % mod;
		return res < 0 ? res + mod : res;
	}
	static long pow(long x, long y) {
		if (y < 0)
			return 0;
		if (y == 0)
			return 1;
		if (y % 2 == 1)
			return (x * pow(x, y - 1)) % mod;
		long root = pow(x, y / 2);
		return root * root % mod;
	}
	public static void main(String[] args) throws Exception {
		is = INPUT.isEmpty() ? System.in : new ByteArrayInputStream(INPUT.getBytes());
		out = new PrintWriter(System.out);
		solve();
		out.flush();
	}
	//input
	static InputStream is;
	static PrintWriter out;
	static String INPUT = "";
	private static byte[] inbuf = new byte[1024];
	static int lenbuf = 0, ptrbuf = 0;
	private static int readByte() {
		if (lenbuf == -1)
			throw new InputMismatchException();
		if (ptrbuf >= lenbuf) {
			ptrbuf = 0;
			try {
				lenbuf = is.read(inbuf);
			} catch (IOException e) {
				throw new InputMismatchException();
			}
			if (lenbuf <= 0)
				return -1;
		}
		return inbuf[ptrbuf++];
	}
	private static boolean isSpaceChar(int c) {
		return !(c >= 33 && c <= 126);
	}
	private static int skip() {
		int b;
		while ((b = readByte()) != -1 && isSpaceChar(b))
			;
		return b;
	}
	@SuppressWarnings("unused")
	private static double nd() {
		return Double.parseDouble(ns());
	}
	@SuppressWarnings("unused")
	private static char nc() {
		return (char) skip();
	}
	private static String ns() {
		int b = skip();
		StringBuilder sb = new StringBuilder();
		while (!(isSpaceChar(b))) {
			sb.appendCodePoint(b);
			b = readByte();
		}
		return sb.toString();
	}
	private static char[] ns(int n) {
		char[] buf = new char[n];
		int b = skip(), p = 0;
		while (p < n && !(isSpaceChar(b))) {
			buf[p++] = (char) b;
			b = readByte();
		}
		return n == p ? buf : Arrays.copyOf(buf, p);
	}
	@SuppressWarnings("unused")
	private static char[][] nm(int n, int m) {
		char[][] map = new char[n][];
		for (int i = 0; i < n; i++)
			map[i] = ns(m);
		return map;
	}
	@SuppressWarnings("unused")
	private static int[] na(int n) {
		int[] a = new int[n];
		for (int i = 0; i < n; i++)
			a[i] = ni();
		return a;
	}
	@SuppressWarnings("unused")
	private static long[] nla(int n) {
		long[] a = new long[n];
		for (int i = 0; i < n; i++)
			a[i] = nl();
		return a;
	}
	@SuppressWarnings("unused")
	private static int[][] na(int n, int m){
		int[][] res = new int[n][m];
		for(int i=0;i<n;i++) {
			for(int j=0;j<m;j++) {
				res[i][j] = ni();
			}
		}
		return res;
	}
	@SuppressWarnings("unused")
	private static long[][] nla(int n, int m){
		long[][] res = new long[n][m];
		for(int i=0;i<n;i++) {
			for(int j=0;j<m;j++) {
				res[i][j] = nl();
			}
		}
		return res;
	}
	private static int ni() {
		int num = 0, b;
		boolean minus = false;
		while ((b = readByte()) != -1 && !((b >= '0' && b <= '9') || b == '-'))
			;
		if (b == '-') {
			minus = true;
			b = readByte();
		}

		while (true) {
			if (b >= '0' && b <= '9') {
				num = num * 10 + (b - '0');
			} else {
				return minus ? -num : num;
			}
			b = readByte();
		}
	}
	private static long nl() {
		long num = 0;
		int b;
		boolean minus = false;
		while ((b = readByte()) != -1 && !((b >= '0' && b <= '9') || b == '-'))
			;
		if (b == '-') {
			minus = true;
			b = readByte();
		}

		while (true) {
			if (b >= '0' && b <= '9') {
				num = num * 10 + (b - '0');
			} else {
				return minus ? -num : num;
			}
			b = readByte();
		}
	}
}


import java.util.*;
public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
      	//数値の入力
		String str = sc.next();
      	int min = 999;
      	for(int i = 1; i+2 < str.length(); i++){
      	int ans = Math.abs(Character.getNumericValue(str.charAt(i))*100
          + Character.getNumericValue(str.charAt(i+1))*10
          +Character.getNumericValue(str.charAt(i+2))
          - 753);
          if(min>=ans){
            min = ans;
          }
        }
      	System.out.println(min);
    }
}


import java.util.*;

public class Main {
	public static void main(String[] args) throws Exception{
		Scanner scn = new Scanner(System.in);
		String s = scn.next();
      int len = s.length();
      int ans = 753;
      int x = 0;
      int xx = 753;
      String list[] = s.split("");
		int[] a = new int[len];
		for(int i=0; i<len; ++i){
			a[i] = Integer.parseInt(list[i]);
		}
      for(int i=0; i<len-2; ++i){
        int x = a[i]*100 + a[i+1]*10 + a[i+2];
        xx = Math.abs(753-x);
        if(ans>xx){
          ans = xx;
        }
      }
      System.out.println(ans);
	}
}


#include<cstdio>
#include<cmath>
#include<cstring>
#include<algorithm>
#include<queue>
#include<map>
#include<vector>
#include<functional>
#include <random>

using namespace std;

int main(void) {
	char S[11];
	int ans, len, t;
	scanf("%s", S);
	len = strlen(S);

	ans = 1000;
  for(int i=0; i<len-2; i++){
			t = (S[i] - '0')*100 + (S[i+1] - '0')*10 + (S[i+2] - '0');
			if(t > 753){
				ans = min(ans, t-753);
			}else{
				ans = min(ans, 753-t);
			}
	}
	printf("%d", ans);
}


#include<stdio.h>
#include<string.h>
#include<cmath>
#include<algorithm>
using namespace std;

int main()
{
    char s[15];
    scanf("%s",s);
    int len = strlen(s);
    int ans = 100000000;
    for(int i = 0; i <= len - 3; i++)
    {
        int tp = (s[i]-'0')*100 + (s[i+1]-'0')*10 + s[i+2]-'0';
        ans = min(ans,abs(tp-753));
    }
    printf("%d\n",ans);
    return 0;
}


#include <stdio.h>
#include <math.h>
#include <stdlib.h>
#include <string.h>
int main(){
    char s[20];
    int sum=0,clo=10000000,m=100,i;
    scanf("%s",s);
    for(i=0;i<strlen(s)-2;i++){
        for(int j=i;j<=i+2;j++){
            sum=sum+(s[j]-48)*m;
            m=m/10;
        }
        if(clo>abs(sum-753)){
               clo=abs(sum-753);

        }
        sum=0;
        m=100;

    }
    if(clo==0){
        printf("0");
    }
    else{

        printf("%d",clo);
    }
}


#include <bits/stdc++.h>

using namespace std;
using ll = long long;

int main()
{
   string s;
   cin>>s;
   int diff, t=753;
   for (int i = 0; i < s.size() -3 ; i++)
   {
       diff = 753 - (s[i]-'0') * 100 - (s[i+1] - '0')*10 - (s[i+2] - '0');
       t = min(t, abs(diff));
   }
   cout<<t;

   return 0;
}


#include <bits/stdc++.h>

using namespace std;
using ll = long long;

int main()
{
   string S;
   cin>>S;
   int diff=753, t=753;
   int s = stoi(S);
   int length = S.size();
   cout<<s<<endl;
   for (int i = 0; i < S.size()-3; i++)
   {
       diff = 753 - s / (int)pow(10, length-3);
       cout<<s / (int)pow(10, length-3)<<endl;
       if (abs(diff)<=t)
       {
           t = abs(diff);
       }
       s = s%(int)pow(10, length-1);
       length -= 1;
       cout<<s<<" "<<length<<endl;
   }
   cout<<t;

   return 0;
}


#include<bits/stdc++.h>
using namespace std;
using ll = long long;
using ull = unsigned long long;
int main(){
    string s;
    cin>>s;
    int ans=1e9;
    for(int i=0;i<s.size();i++){
        for(int j=0;j<3;j++){
            if(i+j>=s.size()){
                break;
            }
            ans=min(ans,abs(753-stoi(s.substr(i,j))));
        }
    }
    cout<<ans<<endl;
    return 0;
}


// AtCoder150 C

#define _CRT_SECURE_NO_WARNINGS
#include <stdio.h>
#include <math.h>
#include <assert.h>
#include <string.h>
#include <memory.h>
#include <malloc.h>
#include <stdlib.h>
#include <ctype.h>

// qsortで用いる比較用関数．*a<*bならaが先になる．
int compare(const void* a, const void* b) {
    return *(int*)a - *(int*)b;
}

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

int main(void)
{
    int i,j,n;
    char s[11];

    scanf("%s", s);

    int min = 753;

    for(i = 0; i < strlen(s)-2;i++){
        int tmp = (s[i]-'0')*100 + (s[i+1]-'0')*10 + (s[i+2]-'0');
        if(min > abs(tmp-753)) min = abs(tmp-753);
    }
    printf("%d", min);
    return 0;

}


#include <stdio.h>
#include <stdlib.h>
#include <string.h>
int main()
{
    char str[11];
    char three[3];
    int num,min=1000,sa,len,i,j=0;

    scanf("%s",str);
    len = strlen(str);
    while(j<len-2){
        strncpy(three, str+j,3);
        three[3] = '\0';
        num = atoi(three);
        sa = 753 - num;
        if(sa<0){
            sa *= -1;
        }
        if(sa < min){
            min = sa;
        }
        j++;
    }

        printf("%d",min);
    return 0;
}


#include <stdio.h>

int main(void)
{
 int i=0, ch,a[10] = {0};

 while((ch = getchar()) != EOF){
  a[i] = ch - '0';
  i++;
 }
 int count = i-1, min = 900;

 for(i=0; i<count-2; i++){
  int num = a[i] * 100 + a[i+1] * 10 + a[i+2];
  int a = (753 > num) ? 753-num : num-753;
  if(min > a){
   min = a;
  }
 }
 printf("%d\n", min);
 return 0;
}


#include <stdio.h>
#include <string.h>
#include <math.h>
#include <stdlib.h>
#include <limits.h>
#include <stdbool.h>

#define rep(i, n) for(int i=0; i<(n); ++i)
#define max  200001

//qsort(str, n, sizeof(int), up_comp);
int up_comp(const void *a, const void *b){return *(int*)a - *(int*)b;}
int down_comp(const void *a, const void *b){return *(int*)b - *(int*)a;}
int int_sort( const void * a , const void * b ) {return strcmp(( char * )a , ( char * )b );}
int count_digit(int a){int i=0;while(a!=0){a=a/10;i++;}return i;}
int euclid( int a, int b ){int temp;if(a<b){temp=a;a=b;b=temp;}if(b<1)return -1;if(a%b==0) return b;return euclid(b,a%b);}

int main(void){

    int se, mmin=INT_MAX;
    char s[11], at[4];

    scanf("%s", s);

    rep(i, strlen(s)-3){
        at[0]=s[i];
        at[1]=s[i+1];
        at[2]=s[i+2];
        se=atoi(at);
        if (mmin>abs(se-753)) {
            mmin=abs(se-753);
        }
    }

    printf("%d\n", mmin);

    return 0;
}


#include <stdio.h>
#include <string.h>
#include <math.h>
#include <stdlib.h>
#include <limits.h>
#include <stdbool.h>

#define rep(i, n) for(int i=0; i<(n); ++i)
#define max  200001

//qsort(str, n, sizeof(int), up_comp);
int up_comp(const void *a, const void *b){return *(int*)a - *(int*)b;}
int down_comp(const void *a, const void *b){return *(int*)b - *(int*)a;}
int int_sort( const void * a , const void * b ) {return strcmp(( char * )a , ( char * )b );}
int count_digit(int a){int i=0;while(a!=0){a=a/10;i++;}return i;}
int euclid( int a, int b ){int temp;if(a<b){temp=a;a=b;b=temp;}if(b<1)return -1;if(a%b==0) return b;return euclid(b,a%b);}

int main(void){

    int se, mmin=INT_MAX;
    char s[11], at[3];

    scanf("%s", s);

    rep(i, strlen(s)-3){
        at[0]=s[i];
        at[1]=s[i+1];
        at[2]=s[i+2];
        se=atoi(at);
        if (mmin>abs(se-753)) {
            mmin=abs(se-753);
        }
    }

    printf("%d\n", mmin);

    return 0;
}


#include <stdio.h>
#include <string.h>
#include <math.h>
#include <stdlib.h>
#include <limits.h>
#include <stdbool.h>

#define rep(i, n) for(int i=0; i<(n); ++i)
#define max  200001

//qsort(str, n, sizeof(int), up_comp);
int up_comp(const void *a, const void *b){return *(int*)a - *(int*)b;}
int down_comp(const void *a, const void *b){return *(int*)b - *(int*)a;}
int int_sort( const void * a , const void * b ) {return strcmp(( char * )a , ( char * )b );}
int count_digit(int a){int i=0;while(a!=0){a=a/10;i++;}return i;}
int euclid( int a, int b ){int temp;if(a<b){temp=a;a=b;b=temp;}if(b<1)return -1;if(a%b==0) return b;return euclid(b,a%b);}

int main(void){

    int se, mmin=INT_MAX;
    char s[11], at[3];

    scanf("%s", s);

    rep(i, strlen(s)-2){
        at[0]=s[i];
        at[1]=s[i+1];
        at[2]=s[i+2];
        se=atoi(at);
        if (mmin>abs(se-753)) {
            mmin=abs(se-753);
        }
    }

    printf("%d\n", mmin);

    return 0;
}


function main(input) {
  var args = input.split("");
  var arr = [];
  for (var i = 0; i < args.length - 2; i++) {
    arr[i] = args[i] + args[i + 1] + args[i + 2];
  }
  for (var i = 0; i < arr.length; i++) {
    arr[i] = parseInt(arr[i], 10);
  }

  var num = arr[0];
  for (var i = 0; i < arr.length; i++) {
    var res = Math.abs(num - 753);
    var res2 = Math.abs(arr[i] - 753);
    if (res > res2) {
      num = arr[i];
    }
  }
  console.log(Math.abs(num - 753));
}

main(require('fs').readFileSync('/dev/stdin', 'utf8'));


function myout(text){console.log(text);}//standard output
function Main(input) {
	//input = parseInt(input);
	//input = input.trim().split(" ");
	//input = input.trim().split("\n");
	//input = input.trim().split(" ").map((a)=>Number(a));
	//input = input.trim().split("\n").map((a)=>Number(a));
  var S = input;
  var output = 1000;
  for(var i = 0; i <= S.length - 3; i++){
    var tmp = parseInt(S.slice(i,i+3));
    output = Math.min(output,Math.abs(753 - tmp));
  }
  myout(output);
}

Main(require("fs").readFileSync("/dev/stdin", "utf8").trim());


s = require('fs').readFileSync('/dev/stdin', 'utf8').split('\n')[0]
min = 10000
for (i=0; i<s.length-2; i++) {
    a = Math.abs(753 - s.slice(i, i+3) * 1)
    if (min > a) {
        min = a
    }
}
console.log(min)


function main(input) {
  const S = input.split('');
  let min;

  for (let i = 0; i < S.length -2; i++) {
    a = parseInt(S[i], 10);
    b = parseInt(S[i+1], 10);
    c = parseInt(S[i+2], 10);
    num = 753 - (a * 100 + b * 10 + c);
    gap = Math.abs(num);
    if (!min || min >= gap) {
      min = gap;
    }
  }

  console.log(min);
}

main(require('fs').readFileSync('/dev/stdin', 'utf8'));


function main(input) {
  const S = input.split('');
  let min;

  for (let i = 0; i < S.length -2; i++) {
    a = parseInt(S[i], 10);
    b = parseInt(S[i+1], 10);
    c = parseInt(S[i+2], 10);
    num = a * 100 + b * 10 + c;
    gap = Math.abs((753 - num));
    if (!min || min >= gap) {
      min = gap;
    }
  }

  if (min === 0) {
    console.log('0');
  } else {
    console.log(min);
  }
}

main(require('fs').readFileSync('/dev/stdin', 'utf8'));


function main(input) {
  const S = input.split('');
  let min;

  for (let i = 0; i < S.length -2; i++) {
    num = S[i] + S[i+1] + S[i+2];
    num = parseInt(num, 10);
    gap = Math.abs(num - 753);
    if (!min || min >= gap) {
      min = gap;
    }
  }

  if (min === 0) {
    console.log('0');
  } else {
    console.log(min);
  }
}

main(require('fs').readFileSync('/dev/stdin', 'utf8'));


package main

import (
	"fmt"
	"strconv"
)

func main() {
	var s string
	fmt.Scanf("%s", &s)

	res := 1<<60
	for i := 0; i <= len(s)-3; i++ {
		x, _ := strconv.Atoi(s[i:i+3])
		d := 753 - x
		if d < 0 {
			d *= -1
		}
		if res > d {
			res = d
		}
	}

	fmt.Println(res)
}


package main

import (
	"bufio"
	"bytes"
	"fmt"
	"io"
	"os"
	"reflect"
	"strconv"
	"unsafe"
)

var DEBUG = true

func main() {
	defer Flush()
	S := readb()

	ans := INF
	for i := 0; i+2 < len(S); i++ {
		var v int
		v += int(S[i]-'0') * 100
		v += int(S[i+1]-'0') * 10
		v += int(S[i+2]-'0') * 1

		d := abs(v - 753)
		if d < ans {
			ans = d
		}
	}
	println(ans)

}

// =============================================================================

// Copyright 2017 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.

// these functions are derived from sort in Go source.
// name of functions are changed

// The function panics if the provided interface is not a slice.
func Reverse(slice interface{}) {
	rv := reflect.ValueOf(slice)
	swap := _reverse_Swapper(slice)
	length := rv.Len()
	for i, j := 0, length-1; i < j; i, j = i+1, j-1 {
		swap(i, j)
	}
}

func _reverse_Swapper(slice interface{}) func(i, j int) {
	v := reflect.ValueOf(slice)
	vdata := v.Pointer()
	vlen := v.Len()
	vcap := v.Cap()

	sz := int(v.Type().Elem().Size())

	// for typical small elements
	switch sz {
	case 24: // for slice
		var s [][3]int64
		h := (*reflect.SliceHeader)(unsafe.Pointer(&s))
		h.Data = vdata
		h.Len = vlen
		h.Cap = vcap
		return func(i, j int) { s[i], s[j] = s[j], s[i] }
	case 16: // for string
		var s [][2]int64
		h := (*reflect.SliceHeader)(unsafe.Pointer(&s))
		h.Data = vdata
		h.Len = vlen
		h.Cap = vcap
		return func(i, j int) { s[i], s[j] = s[j], s[i] }
	case 8:
		var s []int64
		h := (*reflect.SliceHeader)(unsafe.Pointer(&s))
		h.Data = vdata
		h.Len = vlen
		h.Cap = vcap
		return func(i, j int) { s[i], s[j] = s[j], s[i] }
	case 4:
		var s []int32
		h := (*reflect.SliceHeader)(unsafe.Pointer(&s))
		h.Data = vdata
		h.Len = vlen
		h.Cap = vcap
		return func(i, j int) { s[i], s[j] = s[j], s[i] }
	case 2:
		var s []int16
		h := (*reflect.SliceHeader)(unsafe.Pointer(&s))
		h.Data = vdata
		h.Len = vlen
		h.Cap = vcap
		return func(i, j int) { s[i], s[j] = s[j], s[i] }
	case 1:
		var s []int8
		h := (*reflect.SliceHeader)(unsafe.Pointer(&s))
		h.Data = vdata
		h.Len = vlen
		h.Cap = vcap
		return func(i, j int) { s[i], s[j] = s[j], s[i] }
	}

	// for large elements
	if sz%16 == 0 {
		m := sz / 16
		var s [][2]int64
		h := (*reflect.SliceHeader)(unsafe.Pointer(&s))
		h.Data = vdata
		h.Len = vlen * m
		h.Cap = vcap * m
		return func(i, j int) {
			for k := 0; k < m; k++ {
				ri := i*m + k
				rj := j*m + k
				s[ri], s[rj] = s[rj], s[ri]
			}
		}
	}
	if sz%8 == 0 {
		m := sz / 8
		var s []int64
		h := (*reflect.SliceHeader)(unsafe.Pointer(&s))
		h.Data = vdata
		h.Len = vlen * m
		h.Cap = vcap * m
		return func(i, j int) {
			for k := 0; k < m; k++ {
				ri := i*m + k
				rj := j*m + k
				s[ri], s[rj] = s[rj], s[ri]
			}
		}
	}
	if sz%4 == 0 {
		m := sz / 4
		var s []int32
		h := (*reflect.SliceHeader)(unsafe.Pointer(&s))
		h.Data = vdata
		h.Len = vlen * m
		h.Cap = vcap * m
		return func(i, j int) {
			for k := 0; k < m; k++ {
				ri := i*m + k
				rj := j*m + k
				s[ri], s[rj] = s[rj], s[ri]
			}
		}
	}
	if sz%2 == 0 {
		m := sz / 2
		var s []int16
		h := (*reflect.SliceHeader)(unsafe.Pointer(&s))
		h.Data = vdata
		h.Len = vlen * m
		h.Cap = vcap * m
		return func(i, j int) {
			for k := 0; k < m; k++ {
				ri := i*m + k
				rj := j*m + k
				s[ri], s[rj] = s[rj], s[ri]
			}
		}
	} else {
		m := sz
		var s []int8
		h := (*reflect.SliceHeader)(unsafe.Pointer(&s))
		h.Data = vdata
		h.Len = vlen * m
		h.Cap = vcap * m
		return func(i, j int) {
			for k := 0; k < m; k++ {
				ri := i*m + k
				rj := j*m + k
				s[ri], s[rj] = s[rj], s[ri]
			}
		}
	}
}

// =============================================================================
// -----------------------------------------------------------------------------

// IO helper functions

// Returns next token from input.  It must be initialized by SetInput()
// before the first call.
var nextToken func() ([]byte, error)
var nextLine func() ([]byte, error)

// Holds a buffer for output.  It must be initialized by SetOutput().
// All IO fucntions (read*() and [e]print*()) should write to OutputWriter
// instead of this.
var OutputBuffer *bufio.Writer

// Holds an io.Writer.  It must be initialized by SetOutput()
var OutputWriter io.Writer

// Set IO functions for interactive input/output.
func SetInteractive(w io.Writer, r io.Reader) {
	SetUnbefferedInput(r)
	OutputBuffer = nil
	OutputWriter = w
}

// Setup OutputBuffer and OutputWriter.
func SetOutput(w io.Writer) {
	OutputBuffer = bufio.NewWriter(w)
	OutputWriter = OutputBuffer
}

// Flushes OutputBuffer
func Flush() {
	if OutputBuffer != nil {
		OutputBuffer.Flush()
	}
}

// Returns true if c is a white space
func IsSpace(c byte) bool {
	switch c {
	case '\t', '\n', '\v', '\f', '\r', ' ':
		return true
	}
	return false
}

func IsNewLine(c byte) bool {
	switch c {
	case '\n', '\r':
		return true
	}
	return false
}

// Setup nextToken with input buffer.
func SetInput(r io.Reader) {
	buf := new(bytes.Buffer)
	var b []byte

	var i int
	rest := func() ([]byte, error) {
		for i < len(b) && IsSpace(b[i]) {
			i++
		}
		if i == len(b) {
			return nil, io.ErrUnexpectedEOF
		}
		j := i
		for i < len(b) && !IsSpace(b[i]) {
			i++
		}
		return b[j:i], nil
	}
	initial := func() ([]byte, error) {
		io.Copy(buf, r)
		b = buf.Bytes()
		nextToken = rest
		return rest()
	}
	nextToken = initial

	restLn := func() ([]byte, error) {
		for i < len(b) && IsNewLine(b[i]) {
			i++
		}
		if i == len(b) {
			return nil, io.ErrUnexpectedEOF
		}
		j := i
		for i < len(b) && !IsNewLine(b[i]) {
			i++
		}
		return b[j:i], nil
	}

	initialLn := func() ([]byte, error) {
		io.Copy(buf, r)
		b = buf.Bytes()
		nextLine = restLn
		return restLn()
	}
	nextLine = initialLn
}

// Setup nextToken without input buffer.
func SetUnbefferedInput(r io.Reader) {
	buf := bufio.NewReader(r)
	var b []byte

	var i int
	nextToken = func() ([]byte, error) {
		var err error
		if i == len(b) {
			b, err = buf.ReadBytes('\n')
			if err != nil {
				return nil, err
			}
			i = 0
			j := len(b) - 1
			for 0 <= j && IsSpace(b[j]) {
				j--
			}
			b = b[0 : j+1]
		}
		for i < len(b) && IsSpace(b[i]) {
			i++
		}
		j := i
		for i < len(b) && !IsSpace(b[i]) {
			i++
		}
		if i == j {
			return nil, io.ErrUnexpectedEOF
		}
		return b[j:i], nil
	}
}

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

// IO functions

// Reads next token and return it as []byte
func readb() []byte {
	b, err := nextToken()
	if err != nil {
		panic(err)
	}
	return b[:len(b):len(b)]
}

// Reads next token and return it as string
func reads() string {
	return string(readb())
}

// Read next line as []byte.  Trailing '\n' will not be included.
// See also comments on readb()
func readbln() []byte {
	b, err := nextLine()
	if err != nil {
		panic(err)
	}
	return b[:len(b):len(b)]
}

// Read next line as string
func readsln() string {
	return string(readbln())
}

// Reads next token and return it as int64
func readll() int64 {
	i, err := strconv.ParseInt(reads(), 10, 64)
	if err != nil {
		panic(err.Error())
	}
	return i
}

// Reads next token and return it as int
func readi() int {
	return int(readll())
}

// Reads next token and return it as float64
func readf() float64 {
	f, err := strconv.ParseFloat(reads(), 64)
	if err != nil {
		panic(err.Error())
	}
	return f
}

// Write args to OutputWriter with the format f
func printf(f string, args ...interface{}) (int, error) {
	return fmt.Fprintf(OutputWriter, f, args...)
}

// Write args to OutputWriter without format
func println(args ...interface{}) (int, error) {
	return fmt.Fprintln(OutputWriter, args...)
}

// Write args to stderr with the format f
func eprintf(f string, args ...interface{}) (int, error) {
	return fmt.Fprintf(os.Stderr, f, args...)
}

// Write args to stderr without format
func eprintln(args ...interface{}) (int, error) {
	return fmt.Fprintln(os.Stderr, args...)
}

func dbgf(f string, args ...interface{}) {
	if !DEBUG {
		return
	}
	fmt.Fprintf(os.Stderr, f, args...)
}

func dbg(args ...interface{}) {
	if !DEBUG {
		return
	}
	fmt.Fprintln(os.Stderr, args...)
}

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

// Utilities

func sumSlice(a []int) int {
	var res int
	for _, v := range a {
		res += v
	}
	return res
}

func sumSlicell(a []int64) int64 {
	var res int64
	for _, v := range a {
		res += v
	}
	return res
}

func readInts(N int) (int, []int) {
	if N == 0 {
		N = readi()
	}
	a := make([]int, N)
	for i := range a {
		a[i] = readi()
	}
	return N, a
}

func readIntsll(N int) (int, []int64) {
	if N == 0 {
		N = readi()
	}
	a := make([]int64, N)
	for i := range a {
		a[i] = readll()
	}
	return N, a
}

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

// Simple math functions

const (
	// big prime
	INF  = 1000000007
	INF2 = 1000000009
	INF3 = 998244353
)

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

func minll(a, b int64) int64 {
	if a < b {
		return a
	}
	return b
}

func minf(a, b float64) float64 {
	if a < b {
		return a
	}
	return b
}

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

func maxll(a, b int64) int64 {
	if a < b {
		return b
	}
	return a
}

func maxf(a, b float64) float64 {
	if a < b {
		return b
	}
	return a
}

func abs(a int) int {
	if a < 0 {
		return -a
	}
	return a
}

func absll(a int64) int64 {
	if a < 0 {
		return -a
	}
	return a
}

func absf(a float64) float64 {
	if a < 0 {
		return -a
	}
	return a
}

// egcd(a, b) returns d, x, y:
//   d is gcd(a,b)
//   x, y are  integers that satisfy ax + by = d
func egcd(a, b int) (int, int, int) {
	if b == 0 {
		return a, 1, 0
	}
	d, x, y := egcd(b, a%b)
	return d, y, x - a/b*y
}

func egcdll(a, b int64) (int64, int64, int64) {
	if b == 0 {
		return a, 1, 0
	}
	d, x, y := egcdll(b, a%b)
	return d, y, x - a/b*y
}

func gcd(a, b int) int {
	d, _, _ := egcd(a, b)
	return d
}

func gcdll(a, b int64) int64 {
	d, _, _ := egcdll(a, b)
	return d
}

// set up IO functions
func init() {
	// for non-interactive
	SetInput(os.Stdin)
	SetOutput(os.Stdout)

	// Enable below when interactive.  Its ok to leave above intact.
	// SetInteractive(os.Stdout, os.Stdin)
}


package main

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

const mod = 1000000007

// 1MB
const ioBufferSize = 1 * 1024 * 1024

var sc = func() *bufio.Scanner {
	sc := bufio.NewScanner(os.Stdin)
	sc.Buffer(make([]byte, ioBufferSize), ioBufferSize)
	sc.Split(bufio.ScanWords)
	return sc
}()

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

func nextInt() int {
	sc.Scan()
	i, e := strconv.Atoi(sc.Text())
	if e != nil {
		panic(e)
	}
	return i
}

func abs(a int) int {
	if a < 0 {
		return -a
	}
	return a
}

func main() {
	s := next()

	m := 1<<63 - 1
	for i := 0; i < len(s)-2; i++ {
		ss, _ := strconv.Atoi(s[i : i+3])
		if m > abs(ss-753) {
			m = abs(ss - 753)
		}
	}

	fmt.Println(m)
}


package main

import (
	"fmt"
	"math"
	"strconv"
)

func main() {
	var s string
	fmt.Scan(&s)
	if len(s) < 4 && len(s) > 10{
		return
	}
	first_num := s[0 : 3]
	min, _ := strconv.Atoi(first_num)
	fmt.Println(min)
	for i:=1; i<len(s)-2; i++{
		slice_num := s[i : i+3]
		num, _ := strconv.Atoi(slice_num)
		if math.Abs(float64(num)-753.0) < math.Abs(float64(min)-753.0){
			min = num
		}
	}
	fmt.Println(math.Abs(float64(min) - 753.0))
}


package main

import (
	"fmt"
	"math"
	"strconv"
)

func main() {
	var s string
	fmt.Scan(&s)
	if len(s) < 4 && len(s) > 10{
		return
	}
	first_num := s[0 : 3]
	min, _ := strconv.Atoi(first_num)
	fmt.Println(min)
	for i:=1; i<len(s)-2; i++{
		slice_num := s[i : i+3]
		num, _ := strconv.Atoi(slice_num)
		fmt.Println(num)
		if math.Abs(float64(num)-753.0) < math.Abs(float64(min)-753.0){
			min = num
		}
	}
	fmt.Println(math.Abs(float64(min) - 753.0))
}


package main

import (
	"fmt"
	"math"
	"strconv"
)

func main() {
	var s string
	fmt.Scan(&s)
	if len(s) < 4 && len(s) > 10{
		return
	}
	first_num := s[0 : 3]
	min, _ := strconv.Atoi(first_num)
	for i:=1; i<len(s)-2; i++{
		slice_num := s[i : i+3]
		num, _ := strconv.Atoi(slice_num)
		if math.Abs(float64(min-753)) < float64(min){
			min = num
		}
	}
	fmt.Println(math.Abs(float64(min - 753)))
}


#754
s = gets.split('').map(&:to_i)
ans = []
(s.size - 3).times do |i|
	x = 0
	vessel = []
	vessel << s[i]
	vessel << s[i + 1]
	vessel << s[i + 2]
	x = vessel.join.to_i

	ans << (753 - x).abs
end

puts ans.min


s = gets.chomp
diffs = []
(s.length - 2).times do |i|
    num = s[i].to_i * 100 + s[i+1].to_i * 10 + s[i+2].to_i
    diff = (num - 753).abs
    diffs << diff
end
puts diffs.min


s = gets.chomp
sa = 10000
for i in 0..(s.length-3) do
  hoge = (753 - s[i..(i+2)].to_i).abs
  if (sa > hoge)
    sa = hoge
  end
end
puts sa


s = gets.chomp
tmp = s.split("")
ans = []
(0..s.size-3).each do |i|
  ans << tmp[i..i+2].join.to_i
end
puts ans.min_by{|x|(x-753).abs}


s = gets.chomp
tmp = s.split("")
ans = []
(0..s.size-2).each do |i|
  ans << 753 - tmp[i..i+2].join.to_i
end
puts ans.min


B = gets.split('').map(&:to_i)

min = 1000

B.each_cons(3) do |i|
  d = (753 - i.join('').to_i).abs
  min = d if d < min
end

puts min


macro_rules! input {
  (source = $s:expr, $($r:tt)*) => {
      let mut iter = $s.split_whitespace();
      let mut next = || { iter.next().unwrap() };
      input_inner!{next, $($r)*}
  };
  ($($r:tt)*) => {
      let stdin = std::io::stdin();
      let mut bytes = std::io::Read::bytes(std::io::BufReader::new(stdin.lock()));
      let mut next = move || -> String{
          bytes
              .by_ref()
              .map(|r|r.unwrap() as char)
              .skip_while(|c|c.is_whitespace())
              .take_while(|c|!c.is_whitespace())
              .collect()
      };
      input_inner!{next, $($r)*}
  };
}

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

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

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

macro_rules! read_value {
  ($next:expr, ( $($t:tt),* )) => {
      ( $(read_value!($next, $t)),* )
  };

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

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

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

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

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

pub trait LexicalPermutation {
    /// Return `true` if the slice was permuted, `false` if it is already
    /// at the last ordered permutation.
    fn next_permutation(&mut self) -> bool;
    /// Return `true` if the slice was permuted, `false` if it is already
    /// at the first ordered permutation.
    fn prev_permutation(&mut self) -> bool;
}

impl<T> LexicalPermutation for [T]
where
    T: Ord,
{
    /// Original author in Rust: Thomas Backman <serenity@exscape.org>
    fn next_permutation(&mut self) -> bool {
        // These cases only have 1 permutation each, so we can't do anything.
        if self.len() < 2 {
            return false;
        }

        // Step 1: Identify the longest, rightmost weakly decreasing part of the vector
        let mut i = self.len() - 1;
        while i > 0 && self[i - 1] >= self[i] {
            i -= 1;
        }

        // If that is the entire vector, this is the last-ordered permutation.
        if i == 0 {
            return false;
        }

        // Step 2: Find the rightmost element larger than the pivot (i-1)
        let mut j = self.len() - 1;
        while j >= i && self[j] <= self[i - 1] {
            j -= 1;
        }

        // Step 3: Swap that element with the pivot
        self.swap(j, i - 1);

        // Step 4: Reverse the (previously) weakly decreasing part
        self[i..].reverse();

        true
    }

    fn prev_permutation(&mut self) -> bool {
        // These cases only have 1 permutation each, so we can't do anything.
        if self.len() < 2 {
            return false;
        }

        // Step 1: Identify the longest, rightmost weakly increasing part of the vector
        let mut i = self.len() - 1;
        while i > 0 && self[i - 1] <= self[i] {
            i -= 1;
        }

        // If that is the entire vector, this is the first-ordered permutation.
        if i == 0 {
            return false;
        }

        // Step 2: Reverse the weakly increasing part
        self[i..].reverse();

        // Step 3: Find the rightmost element equal to or bigger than the pivot (i-1)
        let mut j = self.len() - 1;
        while j >= i && self[j - 1] < self[i - 1] {
            j -= 1;
        }

        // Step 4: Swap that element with the pivot
        self.swap(i - 1, j);

        true
    }
}

#[cfg(not(debug_assertions))]
macro_rules! mydbg {
    ($($arg:expr),*) => {};
}

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

use std::cmp::Ordering::*;
#[allow(unused_imports)]
use std::cmp::{max, min};
use std::collections::{HashMap, HashSet, VecDeque};
use std::io::{stdout, BufWriter, Write};
use std::mem::swap;

fn main() {
    input! {
        s: String
    }
    let mut ans = std::i32::MAX;
    for v in 0..s.len() - 2 {
        ans = min(ans, (753 - s[v..v + 3].parse::<i32>().unwrap()).abs());
    }
    echo!(ans);
}


use std::io;
use std::cmp::min;

fn procon_read<T: std::str::FromStr>() ->  Vec<T> {
	let mut buf = String::new();
	io::stdin().read_line(&mut buf).expect("");
	let iter = buf.split_whitespace();
	let mut v: Vec<T> = Vec::new();
	for i in iter {
		v.push(i.parse().ok().unwrap());
	}
	v
}

fn main() {
	let mut buf = String::new();
	io::stdin().read_line(&mut buf).expect("");
	let s = buf.trim();
	let mut mini:i32 = 700;
	for i in 0..(s.len()-2) {
		let x = &s[i..(i+3)];
		let xi:i32 = x.parse().ok().unwrap();
		mini = min(mini, (753 - xi).abs());
	}
	println!("{}", mini);
}


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

fn main() {
    let s: Vec<u32> = read::<String>()
        .chars()
        .map(|x| x.to_digit(10).unwrap())
        .collect();

    let mut minv = std::u32::MAX;
    let tn = 753;

    for i in 0..s.len() - 2 {
        let a = s[i];
        let b = s[i + 1];
        let c = s[i + 2];
        let x = 100 * a + b * 10 + c;
        if x > tn {
            if minv > x - tn {
                minv = x - tn;
            }
        } else {
            if minv > tn - x {
                minv = tn - x;
            }
        }
    }
    println!("{}", minv);
}


use proconio::input;

fn diff(a: &[u8]) -> i32 {
    let n: i32 = (a[0] - b'0') as i32 * 100
        + (a[1] - b'0') as i32 * 10
        + (a[2] - b'0') as i32;
    if n >= 753 {
        n - 753
    } else {
        753 - n
    }
}

fn main() {
    input!{
        s: String,
    }
    let sv = s.as_bytes().to_vec();
    let mut mind = i32::MAX;
    for i in 0..sv.len()-2 {
        let d = diff(&sv[i..i+3]);
        if mind > d {
            mind = d;
        }
    }
    println!("{}", mind);
}


#![allow(
    non_snake_case,
    unused_variables,
    unused_assignments,
    unused_mut,
    unused_imports,
    dead_code
)]
//use proconio::fastout;
use proconio::input;
use proconio::marker::*;
//use std::collections::HashSet;
use std::cmp::*;
//use std::collections::VecDeque;

fn main() {
    input! {
      mut S:i32
    }
    let mut ans = 999;

    while S >= 100 {
        let a = S % 1000;
        ans = min(ans, (a - 753).abs());
        S = S / 10;
    }
    println!("{}", ans);
}


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

/*
The read function reads a string according to each one.
*/
fn read<T: FromStr>() -> T {
    let stdin = stdin();
    let stdin = stdin.lock();
    let token: String = stdin
        .bytes()
        .map(|c| c.expect("failed to read char") as char)
        .skip_while(|c| c.is_whitespace())
        .take_while(|c| !c.is_whitespace())
        .collect();
    token.parse().ok().expect("failed to parse token")
}

fn abs(x:i32)-> i32{
    if x < 0{
	-1*x
    }else {
	x
    }
}

//main function
fn main() {
    let number: i32 = 753;
    let mut x: i32 = read();
    let mut min: i32 = x;
    while x > 100 {
	if min > abs(x%1000-number) {
	    min = abs(x%1000-number);
	}
	x /= 10;
    }
    println!("{}",min);
}


let S = readLine()!.characters.map{Int(String($0))!}
var ans = 1000
for i in 0..<S.count-2 {
    ans = min(abs(S[i]*100+S[i+1]*10+S[i+2]-753), ans)
}
print(ans)


let S = readLine()!.characters.map{String($0)}
var ans = 1000
for i in 0..<S.count-2 {
    ans = min(abs(Int(S[i]+S[i+1]+S[i+2])!-753), ans)
}
print(ans)


let S: String = readLine()!
var res: Int = 1000

var idxl: String.Index = S.startIndex
var idxr: String.Index = S.index(S.startIndex, offsetBy: 2)

while idxr < S.endIndex {
    res = min(res, abs(Int(S[idxl...idxr])! - 753))
    idxl = S.index(after: idxl)
    idxr = S.index(after: idxr)
}
print(res)


let S = readLine()!.characters.map{Int(String($0))!}
var ans = 0
for i in 0..<S.count-2 {
    ans = min(abs(S[i]*100+S[i+1]*10+S[i+2]-753), ans)
}
print(ans)


const main = (input: string) => {
  const S = input.trim().split("");
  const X = 753;
  let sumArr = [];

  for (let i = 0; i < S.length - 2; i++) {
    sumArr.push(Math.abs(X - parseInt(S[i] + S[i + 1] + S[i + 2])));
  }

  console.log(Math.min(...sumArr))
}

main(require('fs').readFileSync('/dev/stdin', 'utf8'));


import * as fs from 'fs';

namespace AtCoder.abc114 {

    class Program {

        /**
         * in
         *  1234567876
         * out
         *  34
         */
        main(inp: string): void {

            let ans: number = 99999;

            let wk: string = '';
            inp.split('').forEach(x => {
                wk += x;

                if (wk.length === 4) {
                    wk = wk[1] + wk[2] + wk[3];
                }

                if (wk.length === 3) {
                    let abs: number = Math.abs(753 - parseInt(wk));
                    if (ans > abs) {
                        ans = abs;
                    }
                }
            });

            console.log(ans);

        }
    }

    const func = new Program();
    func.main(fs.readFileSync('/dev/stdin', 'utf8').trim());
}


const t={input:require('fs').readFileSync('/dev/stdin','utf8').split(/[\s]/),n:(arg:number=0):any=>{if(arg){const a=[];for(let i=0;i<arg;i++){a.push(t.n())}return a}else{const a=t.input[0];t.input.shift();return Number(a)}},s:(arg:number=0):any=>{if(arg){const a=[];for(let i=0;i<arg;i++){a.push(t.s())}return a}else{const a=t.input[0];t.input.shift();return String(a)}},c:(arg:number=0):any=>{if(arg){const a=[];for(let i=0;i<arg;i++){a.push(t.c())}return a}else{let a=t.input[0].split('');const b=a[0];a.shift();if(a.length>0){t.input[0]=a.join('')}else{t.input.shift()}return String(b)}},o:(...arg)=>{console.log(...arg)},abs:(a)=>{return Math.abs(a)},min:(...a)=>{return Math.min(...a)},max:(...a)=>{return Math.max(...a)},floor:(a)=>{return Math.floor(a)},asc:(ar:number[])=>{return ar.sort((a,b)=>{return a-b})},desc:(ar:number[])=>{return ar.sort((a,b)=>{return b-a})},sw:(a,arr:any[],op:'=='|'>='|'>'|'<='|'<'='==')=>{for(let i=0;i<arr.length;i+=2){if(eval(a+op+arr[i]))return arr[i+1];}return arr[arr.length-1]}};
const main=()=>{
  let s=t.s()
  let ans=1000;
  for(let i=0;i<s.length-2;i++)ans=t.min(t.abs(753-Number(s[i]+s[i+1]+s[i+2])),ans)
  t.o(ans)
}
main()


s=require("fs").readFileSync("/dev/stdin","utf8");
a = [...Array(s.length-2)].map((_,i)=>Math.abs((s.slice(i,i+3)|0)-753))
Math.min.apply(null,a);


s=String(require("fs").readFileSync("/dev/stdin","utf8"));
Math.min.apply(null,[...Array(s.length-2)].map((_,i)=>Math.abs((s.slice(i,i+3)|0)-753)));


s=require("fs").readFileSync("/dev/stdin","utf8");
Math.min.apply(null,[...Array(s.length-2)].map((_,i)=>Math.abs((s.slice(i,i+3)|0)-753)));


n = int(input())

if n < 10:
    print(n)

elif n < 100:
    print(9)
elif n < 1000:
    print(9 + n-100+1)
elif n < 10000:
    print(9+999-100+1)
elif n < 100000:
    print(9+999-100+1 +n-10000+1)
elif n == 100000:
    print(90909)


N = int(input())
if N<10:
    print(N)
elif N >= 10 and N < 100:
    print(9)
elif N >= 100 and N < 1000:
    print(N-90)
elif N >= 1000 and N < 10000:
    print(909)
elif N >= 10000 and N < 100000:
    print(N - 9090)
else:
    print(90909)


N = int(input())
s = [9,900,90000]
l = len(str(N))
if l ==6:
    print(sum(s))
elif l == 5:
    print(sum(s[:2])+N-9999)
elif l == 4:
    print(sum(s[:2]))
elif l == 3:
    print(sum(s[:1])+N-99)
elif l == 2:
    print(s[0])
else:
    print(N)


n = int(input())
a = 0
for i in (1, n+1):
  if len(str(i)) % 2 == 1:
    a += 1
print(a)


n = int(input())
l = len(str(n))
if l == 2:
  print(9)
elif l == 4:
  print(909)
elif l == 6:
  print(90909)
elif l == 1:
  print(n)
elif l == 3:
  print(n-90)
elif l == 5:
  print(n-8090)


n = int(input())
l = len(str(n))
if l == 2:
  print(9)
elif l == 4:
  print(909)
elif l == 6:
  print(90909)
elif l == 1:
  print(n)
elif l == 3:
  print(n-90)
elif l == 5:
  print(n-8091)


import java.io.*;

/**
 * Created by Ayushi on 04/08/2019.
 */

public class Main {
    public static void main(String[] args) throws IOException {
        BufferedReader r = new BufferedReader(new InputStreamReader(System.in));
        String[] temp = r.readLine().split(" ");
        int n = Integer.parseInt(temp[0]);
        r.close();
        int ans = 0;
        int i;
        for (i = 1; i*10 <= n; i=i*100) {
            ans += (i*9);
        }
        ans += Math.max(n-i+1, 0);

        System.out.println(ans);
    }
}


import java.io.*;

public class Main{
  public static void main(String[] args) throws Exception{
    BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
    String numStr = br.readLine();
    int n = Integer.parseInt(numStr);
    int result = 0;

    for(int i=numStr.length()-1; 0<i; i--) if( i%2 == 1 )
      result += (int)(Math.pow(10, i)-Math.pow(10, i-1));
    if( numStr.length() % 2 == 1 )
      result += n - Math.pow(10, numStr.length()-1) + 1;

    System.out.println(result);
  }
}


import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.Arrays;
import java.util.InputMismatchException;
import java.util.NoSuchElementException;

public class Main {

	static PrintWriter out;
	static InputReader ir;

	static void solve() {
		int n = ir.nextInt();
		int m = Integer.toString(n).length();
		int res = 0;
		int[] a = new int[] { 0, 9, 0, 900, 0, 90000, 0 };
		int[] b = new int[] { 0, 9, 90, 900, 9000, 90000, 900000 };
		int tot = 0;
		for (int i = 1; i < m; i++) {
			res += a[i];
			tot += b[i];
		}
		if (m % 2 == 1)
			res += n - tot;
		out.println(res);
	}

	public static void main(String[] args) {
		ir = new InputReader(System.in);
		out = new PrintWriter(System.out);
		solve();
		out.flush();
	}

	static class InputReader {

		private InputStream in;
		private byte[] buffer = new byte[1024];
		private int curbuf;
		private int lenbuf;

		public InputReader(InputStream in) {
			this.in = in;
			this.curbuf = this.lenbuf = 0;
		}

		public boolean hasNextByte() {
			if (curbuf >= lenbuf) {
				curbuf = 0;
				try {
					lenbuf = in.read(buffer);
				} catch (IOException e) {
					throw new InputMismatchException();
				}
				if (lenbuf <= 0)
					return false;
			}
			return true;
		}

		private int readByte() {
			if (hasNextByte())
				return buffer[curbuf++];
			else
				return -1;
		}

		private boolean isSpaceChar(int c) {
			return !(c >= 33 && c <= 126);
		}

		private void skip() {
			while (hasNextByte() && isSpaceChar(buffer[curbuf]))
				curbuf++;
		}

		public boolean hasNext() {
			skip();
			return hasNextByte();
		}

		public String next() {
			if (!hasNext())
				throw new NoSuchElementException();
			StringBuilder sb = new StringBuilder();
			int b = readByte();
			while (!isSpaceChar(b)) {
				sb.appendCodePoint(b);
				b = readByte();
			}
			return sb.toString();
		}

		public int nextInt() {
			if (!hasNext())
				throw new NoSuchElementException();
			int c = readByte();
			while (isSpaceChar(c))
				c = readByte();
			boolean minus = false;
			if (c == '-') {
				minus = true;
				c = readByte();
			}
			int res = 0;
			do {
				if (c < '0' || c > '9')
					throw new InputMismatchException();
				res = res * 10 + c - '0';
				c = readByte();
			} while (!isSpaceChar(c));
			return (minus) ? -res : res;
		}

		public long nextLong() {
			if (!hasNext())
				throw new NoSuchElementException();
			int c = readByte();
			while (isSpaceChar(c))
				c = readByte();
			boolean minus = false;
			if (c == '-') {
				minus = true;
				c = readByte();
			}
			long res = 0;
			do {
				if (c < '0' || c > '9')
					throw new InputMismatchException();
				res = res * 10 + c - '0';
				c = readByte();
			} while (!isSpaceChar(c));
			return (minus) ? -res : res;
		}

		public double nextDouble() {
			return Double.parseDouble(next());
		}

		public int[] nextIntArray(int n) {
			int[] a = new int[n];
			for (int i = 0; i < n; i++)
				a[i] = nextInt();
			return a;
		}

		public long[] nextLongArray(int n) {
			long[] a = new long[n];
			for (int i = 0; i < n; i++)
				a[i] = nextLong();
			return a;
		}

		public char[][] nextCharMap(int n, int m) {
			char[][] map = new char[n][m];
			for (int i = 0; i < n; i++)
				map[i] = next().toCharArray();
			return map;
		}
	}

	static void tr(Object... o) {
		out.println(Arrays.deepToString(o));
	}
}


import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		 Scanner sc = new Scanner(System.in);
		 int N = sc.nextInt();
		 int count = 0;
		 for(int i=0; i<N; i++) {
			 if(String.valueOf(i).length() %2 != 0) {
				 count++;
			 }
		 }
		 System.out.println(count);
	}
}


import java.util.*;
public class Main{
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    int n = sc.nextInt();
    int ans;
    if(n<9){
      ans = n;
    }else if(n<100){
      ans = 9;
    }else if(n<1000){
      ans = 9+n-99;
    }else if(n<10000){
      ans = 909;
    }else if(n<100000){
      ans = 999+n-9999;
    }else{
      ans = 90909;
    }
    System.out.println(ans);

  }
}


import java.util.Scanner;

public class Main096 {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int ans = 0;
        for(int i=1; i<=n; i++) {
            int nn = Integer.toString(i).length();
            if(nn % 2 != 0) ans++;
        }
        System.out.println(ans);
    }
}


#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <climits>
#include <vector>
#include <algorithm>
#include <functional>

using namespace std;

int main()
{
    int N;
    scanf("%d\n",&N);

    int res=0;
    for(int d=10; d/10<=N; d*=100)
    {
        if(N/d==0){ res+=N-(d/10-1); }
        else{ res+=(d-1)-(d/10-1); }
    }

    printf("%d\n",res);
    return 0;
}


#include <bits/stdc++.h>
using namespace std;
typedef signed long long ll;

#undef _P
#define _P(...) (void)printf(__VA_ARGS__)
#define FOR(x,to) for(x=0;x<(to);x++)
#define FORR(x,arr) for(auto& x:arr)
#define ITR(x,c) for(__typeof(c.begin()) x=c.begin();x!=c.end();x++)
#define ALL(a) (a.begin()),(a.end())
#define ZERO(a) memset(a,0,sizeof(a))
#define MINUS(a) memset(a,0xff,sizeof(a))
//-------------------------------------------------------

int N;

void solve() {
	int i,j,k,l,r,x,y; string s;

	int cnt=0;

	cin>>N;
	for(i=1;i<=9;i++) if(i<=N) cnt++;
	for(i=100;i<=999;i++) if(i<=N) cnt++;
	for(i=10000;i<=99999;i++) if(i<=N) cnt++;
	cout<<cnt<<endl;
}

int main(int argc,char** argv){
	string s;int i;
	if(argc==1) ios::sync_with_stdio(false), cin.tie(0);
	FOR(i,argc-1) s+=argv[i+1],s+='\n'; FOR(i,s.size()) ungetc(s[s.size()-1-i],stdin);
	cout.tie(0); solve(); return 0;
}


#include <iostream>
#include <string>

using namespace std;

int main()
{
	int n;
	cin >> n;

	int digits = 0;

	for (int i = 1; i <= n; i++)
	{
		if (i >= 1 && i <= 9)
			digits += 1;

		if (i >= 100 && i <= 999)
			digits += 1;

		if (i >= 10000 && i <= 99999)
			digits += 1;

		if (i >= 1000000 && i <= 9999999)
			digits += 1;
	}

	cout << digits;

	return 0;
}


#include <bits/stdc++.h>

using namespace std;

#define FOR(i, m, n) for (int i = m; i < n; ++i)
#define FORD(i, m, n) for (int i = m; i >= n; --i)
#define REP(i, n) for (int i = 0; i < n; ++i)
#define REP1(i, n) for (int i = 0; i <= n; ++i)
#define REPR(i, n) for (int i = n; i >= 0; --i)
#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))

using ll = long long;
using ull = unsigned long long;
using ld = long double;

int main()
{
	cin.tie(0);
	ios::sync_with_stdio(false);

	int n;
	cin>>n;
	if(n<10)cout << n << endl;
	else if(n<100)cout << 9 << endl;
	else if(n<1000)cout << n-90 << endl;
	else if(n<10000)cout << 909 << endl;
	else if(n<=100000)cout << n-10000+909 << endl;

	return 0;
}


/************************************************************************
*                  -> Bismillahir Rahmanir Rahim <-                     *
*                                                                       *
*                                                                       *
*                                                                       *
*                                                                       *
* __________             .___        .__              ____ ________     *
* \______   \_____     __| _/  ______|  |__  _____   /_   |\_____  \    *
*  |    |  _/\__  \   / __ |  /  ___/|  |  \ \__  \   |   | /  ____/    *
*  |    |   \ / __ \_/ /_/ |  \___ \ |   Y  \ / __ \_ |   |/       \    *
*  |______  /(____  /\____ | /____  >|___|  /(____  / |___|\_______ \   *
*         \/      \/      \/      \/      \/      \/               \/   *
*                                                                       *
*                                                                       *
*                                                                       *
*              .=.,                                                     *
*             ;c =\                                                     *
*           __|  _/                                                     *
*         .'-'-._/-'-._                                                 *
*        /..   ____    \                                                *
*       /' _  [<BF>] )  \                                               *
*      (  / \--\_>/-/'._ )                                              *
*       \-;_/\__;__/ _/ _/                                              *
*        '._}|==o==\{_\/                                                *
*         /  /-._.--\  \_                                               *
*        // /   /|   \ \ \                                              *
*       / | |   | \;  |  \ \                                            *
*      / /  | :/   \: \   \_\                                           *
*     /  |  /.'|   /: |    \ \                                          *
*     |  |  |--|   |--|     \_\                                         *
*     / _/   \ |   | /___--._) \                                        *
*    |_(---'-| >   | |       '-'                                        *
*           /_/     \_\                                                 *
*                                                                       *
 ***********************************************************************/
#include<bits/stdc++.h>

#define pi acos(-1)
typedef  long long ll;
typedef  unsigned long long ull;
typedef  unsigned un;
#define  vi  vector<int>
#define  vl  vector<ll>
#define  vd  vector<double>

//defined taking input;
#define sf           scanf
#define si(a)        sf("%d",&a)
#define sc(a)        sf("%c",&a)
#define sii(a,b)     sf("%d %d",&a,&b)
#define siii(a,b,c)  sf("%d %d %d",&a,&b,&c)
#define sl(a)        sf("%lld",&a)
#define sll(a,b)     sf("%lld %lld",&a,&b)
#define slll(a,b,c)  sf("%lld %lld %lld",&a,&b,&c)

#define pf           printf
#define pfi(a)       pf("%d\n",a)
#define pfii(a,b)    pf("%d %d\n",a,b)
#define pfl(a)       pf("%ld\n",a)
#define pfn          pf("\n")
#define pfyes        pf("YES\n")
#define pfno         pf("NO\n")
#define pfYes        pf("Yes\n")
#define pfNo         pf("No\n")
#define wh           while
#define wht(t)       while(t--)
#define endl         "\n"
#define pb           push_back

//defined using loop
#define For(i,a,n)   for(int i=a;i<=n;i++)

#define input        freopen("input.txt","r",stdin);
#define output       freopen("output.txt","w",stdout);

using namespace std;

int main()
{
    int a,b;
    si(a);
    if(a>=1&&a<=9){
        b=a-0;
        cout<<b<<endl;
    }
    else if(a>=10&&a<=99){
        b = 9;
        cout<<b<<endl;
    }else if(a>=100&&a<=999){
        b = (a-100)+1+9;
        cout<<b<<endl;
    }else if(a>=1000&&a<=9999){
        b = (999-100)+1+9;
        cout<<b<<endl;
    }else if(a>=10000&&a<=99999){
        b=(999-100)+1+9+(a-1000)+1;
        cout<<b<<endl;
    }else if(a>=100000&&a<=999999){
        b = (999-100)+1+9+(99999-10000)+1;
        cout<<b<<endl;
    }

    return 0;
}


#include<stdio.h>
int main()
{
 int x,i;
 scanf("%d",&x);
 for(i=1;i<=x;i++)
 {
    int n;
    scanf("%d",&n);

   if(n>0)
   n=n+2;
   printf("%d ",n);
 }
return 0;
}


#include <stdio.h>

int main(){
  int n;
  scanf("%d", &n);
  int ans;
  if(n < 10){
    ans = n;
  }else if(n < 100){
    ans = 9;
  }else if(n < 1000){
    ans = 9 + n - 99;
  }else if(n < 10000){
    ans = 909;
  }else if(n < 100000){
    ans = 909 + n - 9999;
  }else{
    ans = 90909;
  }
  printf("%d\n", ans);
  return 0;
}


#include<stdio.h>

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

    if(1<=N && N<=9){
        printf("%d",N);
    }else if(9<N && N<100){
        printf("9");
    }else if(100<=N && N<=999){
        printf("%d",N-90);
    }else if(999<N && N<10000){
        printf("909");
    }else if(10000<=N && N<=99999){
        printf("%d",N-9090);
    }else{
        printf("90909");
    }

    return 0;
}


#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>

int N;

int dk(int i) {
	int ret;

	for (ret=0; i>0; ret++) {
		i/=10;
	}
	return ret;
}

int main(int argc, char *argv[]) {
	int sr;
	int ret=0;

	sr=scanf("%d", &N);

//printf("%d\n", dk(N));

// 1桁:9個
// 3桁:100～999: 900個
// 5桁:10000～99999: 90000個
	switch(dk(N)) {
	case 1: ret=N; break;
	case 2: ret=9; break;
	case 3: ret=909-999+N; break;
	case 4: ret=909; break;
	case 5: ret=90909-99999+N; break;
	case 6: ret=90909; break;
	}

	printf("%d\n", ret);
	fflush(stdout);

	return 0;

}


#include <stdio.h>
int main()
{
  int a,b;
  scanf("%d",&n);
  if(a>=1&&a<=9)
  {
   b=n-0;
   printf("%d\n",b);
  }
  else if(a>=10&&a<=99)
  {
    b=9;
    printf("%d\n",b);
  }
  else if(a>=100&&a<=999)
  {
    b=(a-100)+1+9;
    printf("%d\n",b);
  }
  else if(a>=1000&&a<=9999)
  {
    b=(999-100)+1+9;
    printf("%d\n",b);
  }
  else if(a>=10000&&a<=99999)
  {
    b=(999-100)+1+9+(a-10000)+1;
    printf("%d\n",b);
  }
  else if(a>=100000&&a<=999999)
  {
    b=(999-100)+1+9+(99999-10000)+1;
    printf("%d\n",b);
  }
  return 0;
}


#include<stdio.h>
int main()
{
    int i,j,k;
    scanf("%d",&i);
    if(i >= 1 && i <= 9)
    {
        printf("%d\n",i);
    }
    else if(i >= 10 && i <= 99)
    {
        printf("9\n");
    }
    if(i >= 100 && i <= 999)
    {
        j = (i - 100) + 1;
        k = i + 9;
        printf("%d\n",k);
    }
    else if(i >= 1000 && i <= 9999)
    {
        printf("%909\n");
    }
    else if(i >= 10000 && i <= 99999)
    {
        j = (i - 10000) + 1;
        k = i + 900 + 9;
        printf("%d\n",k);
    }
    else if(i >= 100000 && i <= 999999)
    {
        printf("%90909\n");
    }
    return 0;
}


#include <stdio.h>
int main()
{
  int n,x;
  scanf("%d",&n);
  if(n>=1&&n<=9)
  {
   x=n-0;
   printf("%d",x);
  }
  else if(n>=10&&n<=99)
  {
    x=9;
    printf("%d\n",x);
  }
  else if(n>=100&&n<=999)
  {
    x=(n-100)+1+9;
    printf("%d\n",x);
  }
  else if(n>=1000&&n<=9999)
  {
    x=(999-100)+1+9;
    printf("%d\n",x);
  }
  else if(n>=10000&&n<=99999)
  {
    x=(999-100)+1+9+(n-10000)+1;
    printf("%d\n",x);
  }
  else if(n>=100000&&n<=999999)
  {
    x=(999-100)+1+9+(999999-100000)+1;
    printf("%d\n",x);
  }
  return 0;
}


function Main(input) {
  input = input.split("\n");
  var N = parseInt(input[0]);
  var ans =0;
  for(var i =0;i<6;i++){
    if(N>=Math.pow(10,i)){
      if(i%2==1){
        ans+=Math.pow(10,i)-1;
      }else{
        ans-=Math.pow(10,i)-1;
      }
    }else{
      if(i%2==1){
        ans+=N;
        break;
      }else{
        break;
      }
    }
  }

  console.log('%s', ans);
  return ans;
}

function debug(n){
  var input = document.getElementById("input"+n).value;
  var ans=Main(input);
  var result="WA";
  if(ans==document.getElementById("output"+n).value.split("\n")[0]){
    result="AC";
  }
  document.getElementById("result"+n).innerHTML=result;
}
Main(require("fs").readFileSync("/dev/stdin", "utf8"));


"use strict";

const input = require("fs").readFileSync("/dev/stdin", "utf8");

const N = Number(input);
const main = N => {
  const digit = String(N).length;
  switch (digit) {
    case 1:
      // 1桁の場合 => 数値そのもの
      return N;
      break;
    case 2:
      // 2桁の場合 => 9
      return 9;
      break;
    case 3:
      // 3桁の場合 => 9 + 数値そのもの + 1
      return 9 + 1 + (N - 100);
      break;
    case 4:
      // 4桁の場合 => 9 + 900
      return 9 + 900;
      break;
    case 5:
      // 5桁の場合 => 9 + 900 + 数値そのもの + 1
      return 9 + 900 + 1 + (N - 10000);
      break;
    case 6:
      // 6桁の場合 => 9 + 900 + 90000
      return 9 + 900 + 90000;
      break;
  }

  return N;
};

console.log(main(N));


"use strict";
const Main = (input) =>{
   let xs = input.trim().split('');
   let xs1 = input.trim().split(' ');
   if(xs.length == 1){
   console.log(xs1[0]);
   }else if(xs.length == 2){
   console.log(9);
   }else if(xs.length == 3){
   console.log(xs1[0]-99 + 9);
   }else if(xs.length == 4){
   console.log(909);
   }else if(xs.length == 5){
   console.log(xs1[0]-9999 + 909);
   }else if(xs.length == 6){
   console.log(90909);
   }
}
Main(require('fs').readFileSync('/dev/stdin','utf8'));


"use strict"
const create = () => {
    const input = require("fs").readFileSync("/dev/stdin", "utf8").trim().split("\n");
    const res = {
        "list": input, "index": 0, "max": input.length,
        "hasNext": function() {return this.index < this.max},
        "next": function() { if (!this.hasNext()) {throw "ArrayIndexOutOfBoundsException";}else{return this.list[this.index++];}}
    };
    return res;
}
const o = create();
const next = () => o.next()
const nextInt = () => parseInt(o.next())
const nextStrArray = () => o.next().split(" ")
const nextIntArray = () => o.next().split(" ").map(el => parseInt(el))
const nextCharArray = () => o.next().split("")
const hasNext = () => o.hasNext()
const myout = (...x) => console.log(...x)
const Main = () => {
    let n = nextInt()
    const digit = (x) => String(x).split(" ").length
    let cnt = 0
    for(let i = 1; i<= n; i++){
        let tmp = digit(i)
        if(tmp % 2 !== 0) cnt++
    }
    console.log(cnt)
}
Main()


"use strict"
const create = () => {
    const input = require("fs").readFileSync("/dev/stdin", "utf8").trim().split("\n");
    const res = {
        "list": input, "index": 0, "max": input.length,
        "hasNext": function() {return this.index < this.max},
        "next": function() { if (!this.hasNext()) {throw "ArrayIndexOutOfBoundsException";}else{return this.list[this.index++];}}
    };
    return res;
}
const o = create();
const next = () => o.next()
const nextInt = () => parseInt(o.next())
const nextStrArray = () => o.next().split(" ")
const nextIntArray = () => o.next().split(" ").map(el => parseInt(el))
const nextCharArray = () => o.next().split("")
const hasNext = () => o.hasNext()
const myout = (...x) => console.log(...x)
const Main = () => {
    let n = nextInt()
    const digit = (x) => String(x).split(" ").length
    let cnt = 0
    for(let i = 0; i<= n; i++){
        let tmp = digit(i)
        if(tmp % 2 !== 0) cnt++
    }
    console.log(cnt)
}
Main()


'use strict';
function main(input) {
  const arr = input.trim().split('\n');
  const a = Number(arr[0]);
  let count = 0;

  for (let i = 0; i < a; i ++) {
    if (String(i).length % 2 !== 0) {
      count ++;
    }
  }

  console.log(count);
}

main(require("fs").readFileSync("/dev/stdin", "utf8"));


package main

import "fmt"

func main() {
	var N int
	fmt.Scanf("%d", &N)
	count := 0
	for i := 1; i <= N; i++ {
		if 1 <= i && i < 10 || 100 <= i && i < 1000 || 10000 <= i && i < 100000 {
			count++
		}
	}
	fmt.Println(count)
}


package main

import (
  "fmt"
  "strconv"
)

func pow(args ...int) int {
  x, y := args[0], args[1]
  res := 1
  if len(args) == 3 {
    mod := args[2]
    for y != 0 {
      if y & 1 == 1 {res = res * x % mod}
      y >>= 1
      x = x * x % mod
    }
  }  else {
    for y != 0 {
      if y & 1 == 1 {res *= x}
      y >>= 1
      x *= x
    }
  }
  return res
}

func main() {
  var n int
  fmt.Scan(&n)
  l := len(strconv.Itoa(n))
  cnt := 0
  for i := 0; i < l; i += 2 {
    if i == l - 1 {
      cnt += n - pow(10, i) + 1
    } else {
      cnt += pow(10, i + 1) - pow(10, i)
    }

  }
  fmt.Println(cnt)
}


package main

import (
    "fmt"
    "math"
)

func main() {
    var N int
    len, ans := 0, 0

    fmt.Scan(&N)
    for tmp:=N;tmp>0;tmp,len=tmp/10,len+1 {}

    if len%2==1 {
        ans+=N
    }
    len--

    for i := len; i > 0; i-- {
        if i%2==1 {
            ans+=int(math.Pow10(i))-1
        }else{
            ans-=int(math.Pow10(i))-1
        }
    }
fmt.Println(ans)
}


package main

import (
  "fmt"
)

func num(n int) int {
   count := 1
  for n >= 10 {
    n = n / 10
    count += 1
  }
  return count
}

func main(){
  var N int
  fmt.Scan(&N)

  result := 0
  for i := 1; i < N; i++ {
    if num(i) % 2 != 0 {
      result += 1
    }
  }
  fmt.Println(result)
}


package main

import (
  "fmt"
)

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

  count := 1
  for n >= 10 {
    n = n / 10
    count += 1
  }
  fmt.Println(count)
}