Assessing the number of clusters of a statistical population is one of the essential issues of unsupervised learning. Given n independent observations X 1 , . . . , X n drawn from an unknown multivariate probability density f , we propose a new approach to estimate the number of connected components, or clusters, of the t-level set L(t) = {x : f (x) ≥ t}. The basic idea is to form a rough skeleton of the set L(t) using any preliminary estimator of f , and to count the number of connected components of the resulting graph. Under mild analytic conditions on f , and using tools from differential geometry, we establish the consistency of our method.