depth-first traversal
number of occurence in the list