title: Finding two pairs of integer from an array with the same square sum
body: <p>I'm toubled with a algrithm problem:</p>
  
  <p>You have to determine if there exists a number (not necessarily
  in A) which can be written as a sum of squares of two distinct
  numbers from A in two different ways (note: m^2+n^2 and n^2+m^2
  counts as a single way) and which runs in time n^2 log n in the
  worst case performance.</p>
  
  <p>Could anyone help me, thank you.</p>