A recent survey asked students what pets they have. Based on the results, the following statements are all true:
23 students have dogs.
20 students have cats.
3 students have both dogs and cats.
5 students have no cats or dogs.

How many students were surveyed?