pseudocode for countChange