You can also approach this problem differently if you notice that under uniform prior $p$ follows $\mathrm{Beta}(n/2+1, n/2+1)$ distribution (Pires and Amado, 2008, see also here). Knowing this, you can find such $n$ that maximizes probability of $p$ being within $\pm \varepsilon$ of $0.5$, i.e. that $ \Pr(X \le m) \geq p-\varepsilon $ and $ \Pr(X \le m) \leq p+\varepsilon $.
betapr <- function(n, eps) diff(pbeta(c(0.5-eps, 0.5+eps), n/2+1, n/2+1))
betapr <- Vectorize(betapr, "n")
That for $\varepsilon = 0.05$ returns
> betapr(n, eps = 0.05)
[1] 0.1271114 0.2020283 0.2662452 0.3162281 0.3942332 0.5281417 0.6875108 0.8881346 0.9752351 0.9984892
So with small sample probability that $p$ is anywhere close to $0.5$ is quite small. Beta distribution can be also used for obtaining exact confidence intervals.
Brown, L. D., Cai, T. T., & DasGupta, A. (2001). Interval estimation for a binomial proportion. Statistical science, 101-117.
Pires, A. M., & Amado, C. (2008). Interval estimators for a binomial proportion: Comparison of twenty methods. REVSTAT‒Statistical Journal, 6(2), 165-197.