import java.lang.*;
import java.util.*;
 
public class Main {
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int kari = n+1;
        int keta = 1;
        while((int)(kari/10)!=0){
            keta++;
            kari = (int)(kari/10);
        }
        if(keta == 1){
            System.out.println(n);
        }else if(keta == 2){
            System.out.println(9);
        }else if(keta == 3){
            System.out.println((10+n-100));
        }else if(keta == 4){
            System.out.println(909);
        }else if(keta == 5){
            System.out.println((910+n-10000));
        }else{
            System.out.println(90909);
        }
        sc.close();
    }
}
/tmp/hf-datasets-cache/medium/datasets/42704881117311-config-parquet-and-info-qiankunmu-Project_CodeNet-896c9d36/hub/datasets--qiankunmu--Project_CodeNet_Python800_and_Java250/snapshots/c899fde44a77ba1cc14973ed3de064e4ff3aadc7/Project_CodeNet_Java250.tar.gz