Source: http://gauss.math.luc.edu/greicius/Math201/Fall2012/Lectures/functions-cardinality.article.pdf