Ben's favorite hobby is puzzles such as Heyawake or Nurikabe. Sadly, he has solved every puzzle that exists, so Nic has decided to create a new one for him. In this puzzle, Nic will lay out some cards, each with a positive or negative integer written on its top face (note that zero will not appear on any cards). Ben then must choose some (possible none) of the cards such that no non-empty subset of chosen cards has a product whose absolute value is a perfect square. Ben must also optimize the set of cards he chooses, first maximizing the number of cards he chooses, then maximizing the product of the integers on the cards. The product of the empty set is defined to be $$$1$$$.
As Nic commonly claims, "surely puzzle boy can puzzle it out," and indeed he did. Ben solves these puzzles with such ease that Nic doesn't even have time to verify Ben's answer! Thus, Nic has asked you to write a program that computes the maximum product that Ben can achieve. To make the calculations easier, Nic has guaranteed that each integer written on a card can be expressed as the product of integers between $$$-1000$$$ and $$$1000$$$, inclusive.
The first line of input will consist of a single integer $$$n$$$ ($$$1 \leq n \leq 10^5$$$) — the number of cards Nic will reveal to Ben.
The second line of input will consist of $$$n$$$ integers $$$a_i$$$ ($$$-10^9 \leq a_i \leq 10^9, a_i \neq 0$$$) — the integer on the $$$i$$$th card that Nic reveals. It is guaranteed that the integer written on each card can be expressed as the product of integers between $$$-1000$$$ and $$$1000$$$, inclusive.
Output a single line with a single integer denoting the maximum product that Ben can achieve. Since this answer is large, output a value in the range $$$[0, 998244353)$$$ which is congruent to the maximum product under modulo $$$998244353$$$.
52 4 3 18 8
54
52 4 -3 18 -8
24
52 -3 5 -7 -11
998242043
| Name |
|---|


