30. Answer: $0,2,4,6$ or 8 knights.

Suppose there are $n>8$ knights in a row. Then, for the leftmost one, the difference between the number of knights to the right and to the left of him is $(n-1)$, for the second from the left it is $(n-3)$, and for the third from the left it is $-(n-5)$. All these numbers have different remainders when divided by 3, so one of them is divisible by 3 and is greater than 3 if $n>8$, hence it is not a "simple" number. Therefore, this case is impossible.

We also note that the number of knights cannot be odd, because in this case the difference between the number of knights to the right and to the left of any knight is even, and even numbers are not "simple."

We will show that the number of knights could be any even number from 0 to 8. Indeed, if we place all the knights in a row at the far left, so that any knight is to the left of any liar, then the difference between the number of knights to the right and to the left of any knight will be $1,3,5$ or 7 - all these numbers are "simple." For any liar, this difference is 8, which is not "simple."
30. We will call all odd prime numbers and the number 1 "simple". 2019 knights and liars are standing in a row. Each of them said: "The number of knights to my right and to my left differ by a simple number." How many knights can there be in this row?

( $A$. Kuznetsov)