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.

sabka_din_aayega | 309 |

maggiiiii | 230 |

Anugrah_kumar | 172 |

UtkarshMalik | 150 |

Savage_19 | 146 |

Bishnu Dev Panda | 777 |

sabka_din_aayega | 620 |

Anugrah_kumar | 562 |

okayboss | 552 |

yk12 | 514 |

blackshadows | 5331 |

Ibrahim Nash | 5219 |

akhayrutdinov | 5111 |

mb1973 | 4925 |

Quandray | 4547 |

Login to report an issue on this page.