calculate minimum actions to get nearest good number AP