Answer of Zassounotsukushi is correct, I'd like to expand it
consider center of mass frame, a resting neutron for simplicity. four-momentum is $\underline{p}_n=\binom{m_n}{\vec{0}}$.
neutron decays into proton, electron, antineutrino: $n \rightarrow p^+ e^- \bar{\nu}$
$$
\binom{m_n}{\vec{0}}=\binom{E_p}{\vec{p}_p}+\binom{E_e}{\vec{p}_e}+\binom{E_\nu}{\vec{p}_\nu}
$$
neutrino mass $(m_\nu < 0.2eV)$ is negligible $\Rightarrow E_\nu=|\vec{p}_\nu|$, to maximize electron energy neutrino has to be left without any $\Rightarrow E_\nu=0$
$$
\Rightarrow\binom{m_n}{\vec{0}}=\binom{E_p}{\vec{p}_p}+\binom{E_e}{\vec{p}_e}
$$
for momentum conservation to be satisfied , $\vec{p}_p+\vec{p}_e=\vec0 $, proton momentum has to be $\vec{p}_p=-\vec{p}_e$
$$
\Rightarrow\binom{m_n}{\vec{0}}=\binom{E_p}{-\vec{p}_e}+\binom{E_e}{\vec{p}_e}
$$
Energy-momentum relation can be used: $E_p=\sqrt{p_p^2+m_p^2}=\sqrt{p_e^2+m_p^2}$, $E_e=\sqrt{p_e^2+m_e^2}$
energy conservation:
$$
\Rightarrow m_n = \sqrt{p_e^2 + m_p^2} + E_e
$$
$$
\Rightarrow m_n = \sqrt{E_e^2 - m_e^2 + m_p^2} + E_e
$$
$$
\Rightarrow (m_n - E_e)^2 = E_e^2 - m_e^2 + m_p^2
$$
$$
\Rightarrow E_{e,max} = \frac{m_n^2 - m_p^2 + m_e^2}{2m_n}
$$
$$
\Rightarrow p_{e,max} = \left(\frac{m_n^2 - m_p^2 + m_e^2}{2m_n}\right)^2 - m_e^2
$$
the "mass defect" in transition $n\rightarrow p$ is in the term $m_n^2 - m_p^2$ included
I assumed $c=\hbar=1$