task 6.1 fixed situation when threads count > range length