Monge--Ampère equation plays an important part in Analysis. For example, it is instrumental in mass transport problems. On the other hand, the Bellman function technique appeared recently as a way to consider certain Harmonic Analysis problems as the problems of Stochastic Optimal Control. This brings us to Bellman PDE, which in stochastic setting is often a Monge--Ampère equation or its close relative. We explore the way of solving Monge--Ampère equation by a sort of method of characteristics to find the Bellman function of certain classical Harmonic Analysis problems, and, therefore, of finding full structure of sharp constants and extremal sequences for those problems.