#include #include #include #include #include #include #include using namespace std; typedef long long ll; const int maxn = 200; 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 perfect_square(ll a, ll b) { ll c = (a * a) + (b * b); ll sq = sqrt(c); if(sq * sq == c) { return true; } return false; } int graph[maxn][maxn]; bool visited[maxn]; int match[maxn]; bool dfs(int node) { for(int i = 0; i < maxn; i++) { if(graph[node][i] == 1 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() { memset(graph, 0, sizeof graph); int n; 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 perfect_square(v[i], v[j])) { graph[i][j] = 1; } } } cout << maximum_bipartite_matching() << endl; return 0; }