Fixed the if statement to accept even small 'n'