Detecting number of folds by a simple mathematical property