# Omega Primes DSA Problem Solution

XORing String DSA Problem

In this post, we are going to solve Omega Primes DSA Problem from MediaNet Online assessment. Let’s have a look at the problem statement first and then try to solve the problem.

## Omega Primes DSA Problem Statement

Carl is bored of playing with ordinary prime numbers. Thus, he comes up with some special numbers called Omega Primes.

A number

$X$$X$ is called Omega Prime, if there exists no perfect square

$Y\left(Y>1\right)$$Y (Y > 1)$ such that

$Y$$Y$ divides

$X$$X$.

For example, 6 is an Omega Prime because there is no perfect square except 1 that divides 6.

On the other hand, 12 is not an Omega Prime as 4 (which is a perfect square) is a divisor of 12.

Carl decides to play a bit more with Omega Primes. He has an array

$A$$A$ of integers. Carl wants to find the number of different subsets such that the product of elements for each subset, results in an Omega Prime. Help Carl find this number.

Since this number can be large, output the answer modulo

${10}^{9}+7$$10^9 + 7$.

Input

The first line contains an integer

$1\le n\le 20000$$1\le n \le 20000$ denoting size of array

$A$$A$

The second line contains

$n$$n$ space separated integers, where

$1\le {i}_{th}\le n$$1\le i_{th} \le n$ integer denotes

$1\le A\left[i\right]\le 30$$1\le A[i] \le 30$

Output

Output the answer as described in statement.

Examples
Input
3
2 4 3
Output
3

Input
3
2 2 2
Output
3

Input
6
2 30 15 18 24 22
Output
6


## Omega Primes DSA Problem Solution C++

#include <bits/stdc++.h>
using namespace std;
int primes[10]={2,3,5,7,11,13,17,19,23,29};
int check(int n)
{
for(int i=0;i<10;i++)
{
if(n%(primes[i]*primes[i])==0)
return 0;
}
return 1;
}
int solve(int ind,vector<vector<int>>&dp,int mask,vector<int>&arr)
{
if(ind>=arr.size())
{
return 0;
else
return 1;
}

int flag=0;
int ans=0;

for(int i=0;i<10;i++)
{
if(arr[ind]%primes[i]==0)
{
{
flag=1;
break;
}
else

}
}
if(flag==0)

}

int main() {

int n;
cin>>n;
vector<int>arr;
for(int i=0;i<n;i++)
{
int a;
cin>>a;
if(check(a))
arr.push_back(a);
}
int sz=arr.size();
vector<vector<int>>dp(sz,vector<int>(1024,-1));
//cout<<arr.size();
cout<<solve(0,dp,0,arr);
return 0;

}