Adding a condition to check input list size #cornercase