시간 제한메모리 제한제출정답맞힌 사람정답 비율
1 초 128 MB381796682028.034%

문제

이 이야기는 고창영이 10살 때 있었던 실화이다.

창영이는 10살 때 파스칼을 독학했다. 창영이가 공부하던 책에는 다음과 같은 프로그램이 있었다.

readln(N); 
counter := 0; 
for i := N-1 downto 1 do begin 
    counter := counter + 1; 
    if N mod i = 0 then break; 
end; 
writeln(counter);

창영이는 N을 입력했을 때, 무엇이 출력될지 궁금해졌다.

창영이가 입력한 N이 주어졌을 때, 무엇이 출력되는지 구하는 프로그램을 작성하시오.

입력

첫째 줄에 창영이가 입력한 N이 주어진다. N은 1보다 크거나 같고, 10^9보다 작거나 같은 자연수이다.

출력

첫째 줄에 결과를 출력한다.

예제 입력 1

1

예제 출력 1

0

예제 입력 2

10

예제 출력 2

5

예제 입력 3

27

예제 출력 3

18
W3sicHJvYmxlbV9pZCI6IjI5ODYiLCJwcm9ibGVtX2xhbmciOiIwIiwidGl0bGUiOiJcdWQzMGNcdWMyYTRcdWNlN2MiLCJkZXNjcmlwdGlvbiI6IjxwPlx1Yzc3NCBcdWM3NzRcdWM1N2NcdWFlMzBcdWIyOTQgXHVhY2UwXHVjYzNkXHVjNjAxXHVjNzc0IDEwXHVjMGI0IFx1YjU0YyBcdWM3ODhcdWM1YzhcdWIzNTggXHVjMmU0XHVkNjU0XHVjNzc0XHViMmU0LjxcL3A+XHJcblxyXG48cD5cdWNjM2RcdWM2MDFcdWM3NzRcdWIyOTQgMTBcdWMwYjQgXHViNTRjIFx1ZDMwY1x1YzJhNFx1Y2U3Y1x1Yzc0NCBcdWIzYzVcdWQ1NTlcdWQ1ODhcdWIyZTQuIFx1Y2MzZFx1YzYwMVx1Yzc3NFx1YWMwMCBcdWFjZjVcdWJkODBcdWQ1NThcdWIzNTggXHVjYzQ1XHVjNWQwXHViMjk0IFx1YjJlNFx1Yzc0Y1x1YWNmYyBcdWFjMTlcdWM3NDAgXHVkNTA0XHViODVjXHVhZGY4XHViN2E4XHVjNzc0IFx1Yz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iZuYnNwOzxcL3A+XHJcbiIsImlucHV0IjoiPHA+VGhlIGZpcnN0IGxpbmUgb2YgaW5wdXQgY29udGFpbnMgdGhlIGludGVnZXIgTiAoMSAmbGU7IE4gJmxlOyAxMDxzdXA+OTxcL3N1cD4pLjxcL3A+XHJcbiIsIm91dHB1dCI6IjxwPk91dHB1dCB0aGUgcmVzdWx0IG9uIGEgc2luZ2xlIGxpbmUuJm5ic3A7PFwvcD5cclxuIiwiaGludCI6IiIsIm9yaWdpbmFsIjoiMSIsImh0bWxfdGl0bGUiOiIwIiwicHJvYmxlbV9sYW5nX3Rjb2RlIjoiRW5nbGlzaCJ9XQ==

출처

Contest > Croatian Open Competition in Informatics > COCI 2007/2008 > Contest #5 2번