import java.util.Scanner;
// Superclass
class Checker {
    int limit;
    Checker(int limit) {
        this.limit = limit;
    }
    // Method to count numbers — to be overridden
    int count() {
        return 0; // default implementation
    }
}
// Subclass: checks for adjacent even digits
class Even extends Checker {
    Even(int limit) {
        super(limit); // call parent constructor
    }

    @Override
    int count() { // overriding
        if (limit < 0) {
            System.out.println("Invalid input");
            return -1;
        }

        int cnt = 0;

        for (int num = 1; num <= limit; num++) {
            String numStr = String.valueOf(num);
            int i = 0;

            while (i < numStr.length() - 1) {
                int digit1 = numStr.charAt(i) - '0';
                int digit2 = numStr.charAt(i + 1) - '0';

                // Check if both digits are even
                if (digit1 % 2 == 0 && digit2 % 2 == 0) {
                    cnt++;       // increment count
                    break;       // move to next number
                }
                i++;
            }
        }

        return cnt;
    }
}

// Main class
public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
            int limit = Integer.parseInt(sc.nextLine().trim());

            // Polymorphism: NumberChecker reference, subclass object
            Checker checker = new Even(limit);
            int result = checker.count();
            if (result != -1) {
                System.out.println(result);
            }
    }
}
