#include #include #include #include using namespace std; const int maxn = 200; typedef long long ll; int graph[maxn][maxn]; int n; ll gcd(ll a, ll b) { if(a < b) { swap(a, b); } while(b > 0) { ll tmp = a; a = b; b = tmp % b; } return a; } bool check_perfect_square(ll a, ll b) { ll c = (a * a) + (b * b); ll sq = sqrt(c); if(sq * sq == c) { return true; } return false; } bool visited[maxn]; int match[maxn]; bool dfs(int node) { for(int i = 0; i < maxn; i++) { if(graph[node][i] and !visited[i]) { visited[i] = true; if(match[i] == -1 or dfs(match[i])) { match[i] = node; return true; } } } return false; } int maximum_bipartite_matching() { memset(match, -1, sizeof match); int result = 0; for(int i = 0; i < maxn; i++) { memset(visited, false, sizeof visited); if(dfs(i)) { result++; } } return result; } int main() { cin >> n; vector v(n); for(int i = 0; i < n; i++) { cin >> v[i]; } for(int i = 0; i < n; i++) { for(int j = 0; j < n; j++) { if(gcd(v[i], v[j]) == 1 and check_perfect_square(v[i], v[j])) { graph[i][j] = 1; } } } cout << maximum_bipartite_matching() << endl; return 0; }