  We study a Bernoulli type free boundary problem with two phases
$$J[u]=\int_{\Omega}|\nabla u(x)|^2\,dx+\Phi\big({\mathcal M}_-(u),
{\mathcal{M}}_+(u)\big), \quad u-\bar u\in W^{1,2}_0(\Omega), $$ where $\bar
u\in W^{1,2}(\Omega)$ is a given boundary datum. Here, ${\mathcal M}_1$ and
${\mathcal M}_2$ are weighted volumes of $\{u\le 0\}\cap \Omega$ and
$\{u>0\}\cap \Omega$, respectively, and $\Phi$ is a nonnegative function of two
real variables.
  We show that, for this problem, the Bernoulli constant, which determines the
gradient jump condition across the free boundary, is of global type and it is
indeed determined by the weighted volumes of the phases.
  In particular, the Bernoulli condition that we obtain can be seen as a
pressure prescription in terms of the volume of the two phases of the minimizer
itself (and therefore it depends on the minimizer itself and not only on the
structural constants of the problem).
  Another property of this type of problems is that the minimizer in $\Omega$
is not necessarily a minimizer in a smaller subdomain, due to the nonlinear
structure of the problem.
  Due to these features, this problem is highly unstable as opposed to the
classical case studied by Alt, Caffarelli and Friedman. It also interpolates
the classical case, in the sense that the blow-up limits of $u$ are minimizers
of the Alt-Caffarelli-Friedman functional. Namely, the energy of the problem
somehow linearizes in the blow-up limit.
  As a special case, we can deal with the energy levels generated by the volume
term $\Phi(0, r_2)=r_2^{\frac{n-1}n}$, which interpolates the
Athanasopoulos-Caffarelli-Kenig-Salsa energy, thanks to the isoperimetric
inequality.
  In particular, we develop a detailed optimal regularity theory for the
minimizers and for their free boundaries.
