Given a positive integer N. The task is to check whether a number has exactly three distinct factors or not.

Example 1:

Input:N = 10Output:0Explanation:10 has 4 factors- 1,2,5 and 10.
So, the Ouput is 0.

Example 2:

Input:N = 9Output:1Explanation:9 has 3 factors- 1,3 and 9.
So, the Ouput is 1.

Your Task:
You don't need to read input or print anything. Your task is to complete the function hasThreePrimeFac() which takes an Integer N as input and returns 1 if it has exactly 3 factors else returns 1.

Expected Time Complexity: O(sqrt(N)) Expected Auxiliary Space: O(1)