Function to return the count of numbers that when added with n give a perfect square
public static int countPairsWith ( int n , ArrayList < Integer > perfectSquares , HashSet < Integer > nums ) { int count = 0 ; for ( int i = 0 ; i < perfectSquares . size ( ) ; i ++ ) { int temp = perfectSquares . get ( i ) - n ;