Let P be a polynomial with integer coefficients and degree at least two. We prove an upper bound on the number of integer solutions n ≤ N to n! = P(x) which yields a power saving over the trivial bound. In particular, this applies to a century-old problem of Brocard and Ramanujan. The previous best result was that the number of solutions is o(N). The proof uses techniques of Diophantine and Padé approximation.