A Sphenic Number is a positive integer **N** which is product of exactly three distinct primes. The first few sphenic numbers are 30, 42, 66, 70, 78, 102, 105, 110, 114, …

Given a number **N**, your task is to find whether it is a Sphenic Number or not.

Examples:

```
Input : 30
Output : 1
Explanation : 30 is the smallest Sphenic number,
30 = 2 × 3 × 5
the product of the smallest three primes
Input : 60
Output : 0
Explanation : 60 = 2
```^{2} x 3 x 5
has exactly 3 prime factors but
is not a sphenic number

**Input:**

The first line of input contains an integer T denoting the no of test cases. Then T test cases follow. Each line contains an integer N.

**Output:**

For each test case in a new line print 1 if N is a Sphenic Number else print 0.

**Constraints:**

1<=T<=100

1<=N<=1000

**Example:
Input:**

2

30

60

1

0

If you have purchased any course from GeeksforGeeks then please ask your doubt on course discussion forum. You will get quick replies from GFG Moderators there.

saiujwal13083 | 347 |

isiddhisingh | 252 |

Abhishek_Jadhav | 243 |

_uncle_sam_ | 221 |

c_ocoooo | 217 |

saiujwal13083 | 610 |

SumitSingh27 | 466 |

c_ocoooo | 456 |

rathiarpit29 | 379 |

NaveenKumarNakka | 370 |

blackshadows | 5362 |

Ibrahim Nash | 5242 |

akhayrutdinov | 5111 |

mb1973 | 4931 |

Quandray | 4598 |

Login to report an issue on this page.