popup count values logic