How to run THREAD for EXACTLY 500 times?