import static java.util.Arrays.deepToString;

import java.io.*;
import java.util.*;

public class fibseq_nn_slow {
	static final long[] F;
	static final long MAXN = 1000000000L * 1000000000L;
	static {
		List<Long> f = new ArrayList<Long>();
		f.add(1L);
		f.add(2L);
		while (true) {
			long next = f.get(f.size() - 1) + f.get(f.size() - 2);
			if (next > MAXN) {
				break;
			}
			f.add(next);
		}
		F = new long[f.size()];
		for (int i = 0; i < F.length; i++) {
			F[i] = f.get(i);
		}
	}

	static void solve() throws Exception {
		out.println(solveStupid(nextLong()));
	}

	static String toFibonacci(long n) {
		int i = 0;
		while (i + 1 < F.length && F[i + 1] <= n) {
			i++;
		}
		StringBuilder ret = new StringBuilder();
		while (i >= 0) {
			if (n >= F[i]) {
				n -= F[i];
				ret.append('1');
			} else {
				ret.append('0');
			}
			i--;
		}
		return ret.toString();
	}

	static long solveStupid(long n) {
		StringBuilder s = new StringBuilder();
		for (int i = 1; s.length() < n; i++) {
			s.append(toFibonacci(i));
		}
		s.setLength((int) n);
		int answer = 0;
		for (int i = 0; i < s.length() - 1; i++) {
			if (s.charAt(i) == '1' && s.charAt(i + 1) == '1') {
				answer++;
			}
		}
		return answer;
	}

	static BufferedReader br;
	static StringTokenizer st;
	static PrintWriter out;

	static void debug(Object... a) {
		System.err.println(deepToString(a));
	}

	static int nextInt() throws IOException {
		return Integer.parseInt(next());
	}

	static String next() throws IOException {
		while (st == null || !st.hasMoreTokens()) {
			String line = br.readLine();
			if (line == null) {
				return null;
			}
			st = new StringTokenizer(line);
		}
		return st.nextToken();
	}

	static long nextLong() throws IOException {
		return Long.parseLong(next());
	}

	static double nextDouble() throws IOException {
		return Double.parseDouble(next());
	}

	public static void main(String[] args) {
		try {
			File file = new File("fibseq.in");
			InputStream input = System.in;
			OutputStream output = System.out;
			if (file.canRead()) {
				input = (new FileInputStream(file));
				output = (new PrintStream("fibseq.out"));
			}
			br = new BufferedReader(new InputStreamReader(input));
			out = new PrintWriter(output);
			solve();
			out.close();
			br.close();
		} catch (Throwable e) {
			e.printStackTrace();
			System.exit(1);
		}
	}
}