If a1<a2<⋯<an are the elements of A, then a12+a22,a12+a32,…,a12+an2,a22+an2,…,an−12+an2 belong to A, and we have
a12+a22<a12+a32<⋯<a12+an2<a22+an2<⋯<an−12+an2,
which implies 2n−3≤n. It follows that A has at most 3 elements.
If n=3 and A={a,b,c} with a<b<c, then a2<b2<c2, hence a2+b2<a2+c2<b2+c2.
Since A={a,b,c}={a2+b2,a2+c2,b2+c2}, it follows
a2+b2=a,a2+c2=b,b2+c2=c.(1)
From the first and the last relation in (1) we get a2−c2=a−c, hence a+c=1. Substituting in the second relation of (1) it follows
b=a2+(1−a)2=2a2−2a+1=2(a2−a)+1=−2b2+1,
therefore (2b−1)(b+1)=0, hence b=21. Then a2−a+41=0
leads to a=21, which contradicts a<b.