countChange function