Count Square Sum Triples

Count ordered triples (a, b, c) with 1 ≤ a,b,c ≤ n satisfying a² + b² = c². Both (a,b,c) and (b,a,c) count as distinct triples.

Examples
Input: 5
Output: 2
Hints

Count Square Sum Triples

Count ordered triples (a, b, c) with 1 ≤ a,b,c ≤ n satisfying a² + b² = c². Both (a,b,c) and (b,a,c) count as distinct triples.