Let P be a polynomial satisfying the statement. P cannot have 0 as a root, so P has all roots between 1 and p−1, except 1, denoted by a. Thus,
Pa(X)=X−aXp−1−1=X−aXp−1−ap−1=Xp−2+aXp−3+⋯+ap−2
Among the p−1 candidates to satisfy the statement, it remains to verify those that have pairwise distinct non-zero coefficients. If Pa has pairwise distinct coefficients, then since Pa is monic, the order of a modulo p is at least p−1, so by Fermat, the order is exactly p−1. In particular, a is a primitive root. Conversely, if a is a primitive root, 1,a,…,ap−2 are distinct modulo p, so Pa works.
Thus, there are as many polynomials as there are primitive roots modulo p, i.e., ϕ(p−1).