[cpp]
#include<iostream>
#include<algorithm>
#include<cstdio>
using namespace std ;
const int maxn = 305 ;
int c1[ maxn ] , c2[ maxn ] ;
int main()
{
int n ;
int i , j , k ;
while( scanf( "%d" , &n ) != EOF && n )
{
for( i = 0 ; i <= n ; ++ i )
{
c1[ i ] = 1 ;
c2[ i ] = 0 ;
}
for( i = 2 ; i * i <= n ; ++i )
{
for( j = 0 ; j <= n ; ++j )
for( k = 0 ; k + j <= n ; k += i * i )
{
c2[ k + j ] += c1[ j ] ;
}
for( j = 0 ; j <= n ; ++j )
{
c1[ j ] = c2[ j ] ;
c2[ j ] = 0 ;
}
}
printf( "%d\n" , c1[ n ] ) ;
}
return 0 ;
}