A group of five friends decides to play Secret Santa, each buying a gift for their secret friend. According to the rules of the game, each person gives exactly one gift and receives exactly one gift. In how many ways can the gifts be distributed so that no one gives a gift to themselves?
First, let's observe that the number of ways to distribute the gifts without any restrictions is $5!=5 \times 4 \times 3 \times 2 \times 1=120$. From this, we need to subtract the "bad" cases, that is, the cases where at least one friend ends up with their own gift. These cases to be eliminated can be listed by the number of friends who end up with their own gift.

- All 5 friends end up with their own gifts. There is only one possibility for this to happen.
- Exactly 4 friends end up with their own gifts. This is not possible.
- Exactly 3 friends end up with their own gifts. In this situation, the other two friends swap the gifts. Thus, we choose 3 people out of 5, which is $\frac{5 \times 4 \times 3}{3 \times 2}=10$ possibilities.
- Exactly 2 friends end up with their own gifts. In this case, we choose 2 people out of 5, which is $\frac{5 \times 4}{2}=10$ possibilities. The other 3 friends swap the gifts among themselves, giving a total of $10 \times 2=20$ possibilities.
- Lastly, exactly one friend ends up with their own gift. In this case, we choose one person out of a total of 5, and multiply by the number of ways the other friends do not end up with their own gifts, which are 9 ways. Thus, in this situation, we have a total of $5 \times 9=45$ possibilities.

Therefore, we have $120-45-20-10-1=44$ ways to distribute the gifts without anyone ending up with their own gift.