public static void main(String[] args) {

		long max = 0;
		long maxindex = 0;
		for (int i = 1; i < 1e6; i++) {
			// System.out.println(i);
			long temp = trace(i);
			if (temp > max) {
				maxindex = i;
				max = temp;
			}
		}

		System.out.println(maxindex);
	}