Thirteen or, more rarely, fourteen.
It's widely believed that this phrase originated from the practice of medieval English bakers giving an extra loaf when selling a dozen in order to avoid being penalized for selling short weight. This is an attractive story and, unlike many that inhabit the folk memory, it appears to be substantially true. We can say a little more to flesh out that derivation.
Firstly, the practice appears to have originated several centuries before the phrase. England has a long history of regulation of trade; bakers were regulated by a trade guild called The Worshipful Company of Bakers, which dates back to at least the reign of Henry II (1154-89). The law that caused bakers to be so wary was the Assize of Bread and Ale. In 1266, Henry III revived an ancient statute that regulated the price of bread according to the price of wheat. Bakers or brewers who gave short measure could be fined, pilloried or flogged, as in 1477 when the Chronicle of London reported that a baker called John Mund[e]w was 'schryved [forced to admit his guilt] upon the pyllory' for selling bread that was underweight.
Secondly, it's not quite so neat an explanation that whenever bakers sold twelve loaves they then added another identical loaf to make thirteen. They would have had just as much concern when selling eleven loaves, but there's no baker's eleven. Remember that the Assize regulated weight not number. What the bakers were doing whenever they sold bread in any quantity was adding something extra to make sure the total weight wasn't short. The addition was called the 'in-bread' or 'vantage loaf'. When selling in quantity to middlemen or wholesalers they would add an extra loaf or two. When selling single loaves to individuals they would offer a small extra piece of bread. The Worshipful Company still exists and reports that this carried on within living memory and that a small 'in-bread' was often given with each loaf.
So, that's the practice, what about the phrase? That goes back to at least 1599, as in this odd quotation from John Cooke's Tu Quoque:
"Mine's a baker's dozen: Master Bubble, tell your money."
The phrase is related to the practice described in John Goodwin's A Being Filled with the Spirit, referring back to a quotation from 1665:
"As that which we call the in-bread is given into the dozen, there is nothing properly paid or given for it, but only for the dozen."
By 1864 Hotten's Slang Dictionary gives this explicit definition for 'baker's dozen':
"This consists of thirteen or fourteen; the surplus number, called the inbread, being thrown in for fear of incurring the penalty for short weight."