//Задача "Возведение в степень"
//1-ая личная интернет-олимпиада сезона 2009-2010
//Автор решения: Носенко Максим, nosenkomax@gmail.com

import java.util.*;
import java.io.*;
import java.math.BigInteger;
import static java.math.BigInteger.*;

public class pow_mn implements Runnable {

	public static void main(String args[]) {
		new Thread(new pow_mn()).start();
	}

	BufferedReader br;
	StringTokenizer st;
	PrintWriter out;
	private String FNAME = "pow";
	boolean eof = false;

	@Override
	public void run() {
		try {
			Locale.setDefault(Locale.US);
			br = new BufferedReader(new FileReader(FNAME + ".in"));
			out = new PrintWriter(FNAME + ".out");
			solve();
			br.close();
			out.close();

		} catch (Exception e) {
			e.printStackTrace();
			System.exit(566);
		}
	}

	String nextToken() {
		while (st == null || !st.hasMoreTokens()) {
			try {
				st = new StringTokenizer(br.readLine());
			} catch (IOException e) {
				eof = true;
				return "0";
			}
		}
		return st.nextToken();
	}

	int nextInt() {
		return Integer.parseInt(nextToken());
	}

	long nextLong() {
		return Long.parseLong(nextToken());
	}

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

	void My_Assert(boolean b, String s) {
		if (!b)
			throw new Error("Assertion " + s);
	}

	final int MAX = 100;

	private void solve() {
		int k = nextInt();
		My_Assert(1 <= k && k <= 29, "k is out of range: " + k);
		if (k == 1) {
			out.println(11);
			return;
		}

		BigInteger ans = ZERO;
		BigInteger L = TEN.pow(k - 1);
		BigInteger R = TEN.pow(k).subtract(ONE);

		BigInteger A, B;

		for (int i = 1; i < MAX; i++) {
			A = floor(R, i);
			B = ceil(L, i);
			if (A.compareTo(B) >= 0)
				ans = ans.add(A).subtract(B).add(ONE);
		}

		out.println(ans);

	}

	final int BS = 100;

	// first number b such as b^p >= a
	private BigInteger ceil(BigInteger a, int p) {
		BigInteger L = ONE;
		BigInteger R = a;
		BigInteger M;
		for (int i = 0; i < BS; i++) {
			M = L.add(R).add(ONE).shiftRight(1);
			if (M.pow(p).compareTo(a) >= 0)
				R = M;
			else
				L = M;
		}
		return R;
	}

	// last number b such as b^p <= a
	private BigInteger floor(BigInteger a, int p) {
		BigInteger L = ONE;
		BigInteger R = a.add(ONE);
		BigInteger M;
		for (int i = 0; i < BS; i++) {
			M = L.add(R).shiftRight(1);
			if (M.pow(p).compareTo(a) <= 0)
				L = M;
			else
				R = M;
		}
		return L;
	}
}