import java.util.*; import java.io.*; public class Main { public static void main(String[] args) throws Exception { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); int n = Integer.parseInt(br.readLine()); int[] coins = new int[5000]; for (int i = 1; i < 5000; i++) { coins[i] = i * (i + 1) / 2; if (n == coins[i]) { System.out.println(1); return; } } int right = 4999; for (int i = 0; i <= right; i++) { while (coins[i] + coins[right - 1] > n) { right--; } if (coins[i] + coins[right - 1] == n) { System.out.println(2); return; } } System.out.println(3); } }