  The fractional Josephson effect is known to be a characteristic phenomenon of
topological Josephson junctions hosting Majorana zero modes (MZMs), where the
Josephson current has a $4\pi$ (rather than a $2\pi$) periodicity in the phase
difference between the two topological superconductors. We introduce a
one-dimensional model of a topological
superconductor/normal-metal/superconductor (SNS) junction with the normal-metal
(N) region of finite length, which is intermediate regime between the short-
and long-junction limits. Assuming weak tunneling at the SN interfaces, we
investigate resonance and finite-size effects on the fractional Josephson
effect due to the existence of several discrete energy levels in the N region
in which wavefunctions have oscillating nodal structure. Through careful
analysis of the sign change in the transmission amplitudes through the junction
and the fermion parity of the two MZMs, we find that the fractional Josephson
current is proportional to the parity of total fermion numbers including both
filled normal levels and two MZMs. Furthermore, we elucidate drastic
enhancement of the Josephson current due to the resonance between a discrete
level in the N region and MZMs.
