In combinatorics, the inclusion-exclusion principle states that if A1, ..., An are finite sets, then
The principle is sometimes stated in the form that says that if
Perhaps the most well-known application of the inclusion-exclusion principle is to the combinatorial problem of counting all derangements of a finite set. A derangement of a set A is a bijection from A into itself that has no fixed points. Via the inclusion-exclusion principle one can show that if the cardinality of A is n, then the number of derangements is the nearest integer to