The quick answer is that such a number does not exist. You may add as many characters as you wish in your tale. It's your narrative, and there are no rules to follow in order to produce a fantastic story. It is your responsibility to own the creative process. However, some readers find more than one character difficult to follow.
Stories within stories, or enigmas, can be very confusing if there are too many characters involved. In such cases, it might help to divide up the roles among several authors or even drop some characters from the story (provided they are important to the plot). Or, if you prefer a more continuous story experience, consider limiting the number of characters by using personification (wherein each character is represented by an object), or create a character wheel where each character gets to speak only once.
A decent rule of thumb is to include only as many characters as are required to tell the narrative and evoke the appropriate style and scope—no more. This number might be as low as 2–5 minor characters in intimate novels, and as high as 20–30 in larger works. Even if you add some extra characters just in case they appear important later on, try not to go over this number.
The more characters there are the longer the story will take to read/listen to. So always choose your cast wisely!
There are lots of different types of stories out there - some stories need more explanation than others, but as a general rule, you shouldn't need to know exactly who did what to whom or why they did it before you can understand what happens next. A good story should be self-contained, so that even if you don't know anything about the characters or the setting, you'll still enjoy reading or listening to it.
In order to keep things simple, avoid having multiple main characters unless they are very distinct from each other. It's easy to confuse which character we're attached to at any given moment, so make sure that whoever that may be, they stays consistent throughout.
A script usually features three primary characters. However, your script can have as many characters as necessary to portray the plot. With that stated, there is a minimum amount of stories that each narrative must contain. In addition, studies show that each genre has an average amount of songs. For example, films tend to feature one song per minute while documentaries only have about four minutes of footage per hour.
The more characters there are in a screenplay, the more difficult it will be to produce a film. The same number of actors can wear more than one costume at a time or use double roles to cut down on costs. Also, with more characters, there is a higher chance that something will go wrong during production. For example, if a character dies, this may cause problems with how the script ends and may need to be rewritten.
Films with more than two main characters are called "miniseries". These scripts are even harder to write than two-character movies because they require more attention to detail. For example, a miniseries about a crime scene photo booth might feature shots of different areas of the photo booth with different characters standing in them. This would be difficult to accomplish using just two characters.
Some movies have been made with as many as seven main characters.
In my experience, the fewer the characters, the shorter the plot. I like to utilize no more than two characters in a narrative of 1000 words or fewer. Three or four characters are frequently sufficient in a story of roughly 3,000 words. A single character suffices for flash fiction of 500 words or fewer.
The most important thing is that you keep the story moving. You can use as few characters as necessary so long as each one plays a crucial role in advancing the tale.
Here are some examples using only two characters:
Story 1: Jack's car breaks down on the way to work. Jill works in the same office as Jack, and when he doesn't show up, she goes looking for him. She sees his car outside with its lights on but nobody inside. Frightened, she calls her boss to say she won't be able to come in that day. The story ends here, but it could have gone in any number of different directions. For example: Jack is not working today; instead, he's at home waiting for his car to be fixed. Or: Jill finds Jack dead. The point is that we don't know what happens after she sees his car outside with its lights on but nobody inside. This story would work well as a flash piece because it's so short.
Story 2: Jack runs out of gas on the side of the road.