now handle duplicated nums