I am trying to evaluate the functional derivatives $\dfrac{\delta F[\phi(\textbf{r})]}{\delta n_{1}}$ and $\dfrac{\delta F[\phi(\textbf{r})]}{\delta n_{2}}$ where
\begin{gather} F[\phi_1(\textbf{r}), \phi_2(\textbf{r})] = \int d \textbf{r} \bigl [ f (\phi_{1}(\textbf{r}), \phi_{2}(\textbf{r}), \nabla\phi_{1}(\textbf{r}), \nabla\phi_{2}(\textbf{r}) ) \bigr ] \\ n_{1}[\phi_1(\textbf{r})] = \int d\textbf{r} \, g_{1} (\phi_{1}(\textbf{r})) \\ n_{2}[\phi_2(\textbf{r})] = \int d\textbf{r} \, g_{2} (\phi_{2}(\textbf{r})) \end{gather}
I have explicit expressions for $f$, $g_1$ and $g_2$. I believe the appropriate chain rule for functional derivatives is given by
\begin{equation} \frac{\delta F[\phi_1, \phi_2]}{\delta n_{1}} = \int d\textbf{r} \left ( \frac{\delta F}{\delta \phi_1} \frac{\delta \phi_{1}}{\delta n_1} + \frac{\delta F}{\delta \phi_2} \frac{\delta \phi_{2}}{\delta n_1}\right) \textrm{.} \end{equation}
But the chain rule is only useful if I know $\phi_1[n_1]$, when in fact I have the inverse. How can I evaluate these derivatives?
Related: Derivative of a functional with respect to another functional