import java.math.BigInteger; import java.util.Scanner; public class Main { public static void main(String[] args) throws Exception { Scanner sc = new Scanner(System.in); int n = sc.nextInt(); sc.close(); if (n == 1) { System.out.println(1); return; } BigInteger nb = BigInteger.valueOf(n); BigInteger a = BigInteger.ONE; BigInteger b = BigInteger.ONE; int i = 2; while (true) { i++; BigInteger c = a.add(b); if (c.mod(nb).compareTo(BigInteger.ZERO) == 0) { System.out.println(i); return; } a = b; b = c; } } }