adding while with variable n