CDRSANJ - CODER FIRST PROBLEM


Coder Sanjay is now ready to put up his first problem in his favorite website SPOJ. As it is his first problem, he wanted it to be easy so that most of them could get an AC.

The problem statement looks like this:

F(x) is a function whose properties are as follows.

  1. F(x) = 0 at x = 0.
  2. F(x) = 1 at x = 1.
  3. F(x) = 2 at x = 2.
  4. F(x) = 0 if x is an odd prime.
  5. F(a*b) = F(a) + F(b), where a, b are two positive integers and sum of a and b is minimum.

Your task is simple. You are to output the value of F(x) for the given input integer x.

Input

The only line of input contains a single integer x (0 < x < 100001).

Output

Output the value of F(x).

Example

Input:
4

Output:
4

hide comments
abhaypandey: 2016-12-22 04:19:51

just two lines of code

aditya_rev: 2016-11-04 04:02:25

nice recurtion problem. enjoying to solve it :)

ftnovac: 2016-09-24 11:28:37

Be careful with test cases like:
Input: 128 256 512
Output: 14 16 18

No need to use any fancy algorithm (Sieve).

Last edit: 2016-09-24 11:29:39
rishabh_nitw: 2016-08-10 15:49:27

NO need to use DP bcz problm contains only one test case case and no sub problem will repeat. :)

vinay12345: 2016-08-05 17:02:52

no use of sieve no use of anything only use 2 to find answer ......haha

bais_hariom: 2016-07-31 20:33:34

Nice Problem! #DP and #Recursion

get_right_jr: 2016-06-20 11:54:08

Awesome problem
AC in first attempt

Vaporeon: 2016-05-11 22:03:26

easy rec :)

pavithranrick: 2016-05-10 16:25:42

This is a basic problem...so who haven't solved more than 30 problems can give this a try!!!

PS: This is comment is just for motivating those guys...

Last edit: 2016-05-10 16:27:11
rayhan50001: 2016-04-26 16:34:41

nice one.. AC in 2nd.


Added by:verdu sanjay
Date:2016-03-12
Time limit:1s
Source limit:50000B
Memory limit:1536MB
Cluster: Cube (Intel G860)
Languages:All except: GOSU