$p$ is a prime. Let $K_p$ be the set of all polynomials with coefficients from the set $\{0,1,\dots ,p-1\}$ and degree less than $p$. Assume that for all pairs of polynomials $P,Q\in K_p$ such that $P(Q(n))\equiv n\pmod p$ for all integers $n$, the degrees of $P$ and $Q$ are equal. Determine all primes $p$ with this condition.
1. **Understanding the Problem:**
   We need to determine all primes \( p \) such that for all pairs of polynomials \( P, Q \in K_p \) (where \( K_p \) is the set of all polynomials with coefficients from \(\{0, 1, \ldots, p-1\}\) and degree less than \( p \)), if \( P(Q(n)) \equiv n \pmod{p} \) for all integers \( n \), then the degrees of \( P \) and \( Q \) are equal.

2. **Initial Consideration:**
   Suppose \( P(x) = x^a \) and \( Q(x) = x^b \) where \( a \) and \( b \) are integers such that \( a, b < p \). If \( P(Q(n)) \equiv n \pmod{p} \), then \( (x^b)^a \equiv x \pmod{p} \). This implies \( x^{ab} \equiv x \pmod{p} \), which means \( ab \equiv 1 \pmod{p-1} \).

3. **Condition on \( a \) and \( b \):**
   For \( ab \equiv 1 \pmod{p-1} \), \( a \) and \( b \) must be multiplicative inverses modulo \( p-1 \). If \( a \) and \( b \) are not equal, then \( P \) and \( Q \) would have different degrees, which contradicts the given condition. Therefore, for all \( a \) such that \( \gcd(a, p-1) = 1 \), we must have \( a^2 \equiv 1 \pmod{p-1} \).

4. **Analyzing \( a^2 \equiv 1 \pmod{p-1} \):**
   The equation \( a^2 \equiv 1 \pmod{p-1} \) implies \( (a-1)(a+1) \equiv 0 \pmod{p-1} \). This means \( a \equiv 1 \pmod{p-1} \) or \( a \equiv -1 \pmod{p-1} \). Therefore, \( p-1 \) must be such that the only solutions to \( a^2 \equiv 1 \pmod{p-1} \) are \( a \equiv 1 \) or \( a \equiv -1 \).

5. **Prime Factorization of \( p-1 \):**
   We need to check the prime factorization of \( p-1 \). If \( p-1 \) has a prime factor \( q \geq 3 \), then \( 2^2 \not\equiv 1 \pmod{q} \), which means \( p-1 \) cannot have any prime factors \( q \geq 3 \) unless \( q = 3 \) and \( k = 1 \) (i.e., \( p-1 = 3 \)). Similarly, for \( p-1 = 2^k \), \( k \leq 3 \) because \( 3^2 \not\equiv 1 \pmod{2^k} \) for \( k \geq 4 \).

6. **Possible Values of \( p-1 \):**
   The possible values of \( p-1 \) are \( 1, 2, 4, 8, 3, 6, 12, 24 \). Therefore, the possible values of \( p \) are \( 2, 3, 5, 9, 4, 7, 13, 25 \). Since \( p \) must be a prime, the possible values are \( 2, 3, 5, 7, 13 \).

7. **Verification:**
   - For \( p = 2, 3, 5 \), the degrees of \( P \) and \( Q \) must be bijections and thus must be linear, ensuring the degrees are equal.
   - For \( p = 7 \), the degrees of \( P \) and \( Q \) must be \( 4, 5 \), which can be checked similarly.
   - For \( p = 13 \), we need to check if there exist polynomials \( P \) and \( Q \) of degrees \( 5, 7, 8, 9, 10, 11 \) that satisfy the condition. The given example \( f(x) = x^5 + 5x^3 + 5x \) and \( g(x) = 12x^9 + 4x^7 + 6x \) shows that \( p = 13 \) does not satisfy the condition.

Therefore, the primes \( p \) that satisfy the condition are \( 2, 3, 5, 7 \).

The final answer is \( \boxed{2, 3, 5, 7} \)