Quantum contextuality is one of the most recognized resources in quantum communication and computing scenarios. We provide a new quantifier of this resource, the rank of contextuality (RC). We define RC as the minimum number of non-contextual behaviors that are needed to simulate a contextual behavior. We show that the logarithm of RC is a natural contextuality measure satisfying several properties considered in the spirit of the resource-theoretic approach. The properties include faithfulness, monotonicity, and additivity under tensor product. We also give examples of how to construct contextual behaviors with an arbitrary value of RC exhibiting a natural connection between this quantifier and the arboricity of an underlying hypergraph. We also discuss exemplary areas of research in which the new measure appears as a natural quantifier.