Don't you think i<(count-1) will not loop through all the elements.