A Stochastic Theory of the Hierarchical Clustering. I. Halo Mass Function