If this is a screen lock or start up pin you're entering, and the count is going down by one with every wrong entry, then that is a security feature that will factory reset the phone when it hits zero.
If this is your phone, you should remember your pin and this wouldn't be happening. If this belongs to someone else, then you should give it back before you erase all of their data.