public class Main {
public static void main(String[] args) throws IOException{
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
int n = Integer.parseInt(br.readLine());
System.out.println(cutRope(n));
}
private static int cutRope(int target){
int a = 0;
int c = 0;
int maxValue = 2;
if (target == 2){
return 1;
}
if (target == 3) {
return 2;
}
if (target % 3 == 0){
maxValue = (int)Math.pow(3,target / 3);
} else{
a = target - 2;
c = a % 3;