Why increase cnt two times? that doesn't meet the algo in the doc string(1/cnt*diff).