Three-dimensional reddening map for stars from 2MASS photometry: The method and the first results