You have to take the lesson from each failure and make sure it doesn't repeat itself again. By that analogy, you are practically permitted to fail only once. Anything beyond that, you might be already running a loss business.
The most important thing is for you to have a very good plan so that you can keep on trying. This is because as long as you don't have a very good plan, then there is no point in trying because it is certain that you're going to fail.