This is actually a complicated position (no wonder it's a "hard puzzle"?).
First, we note that White has a substantial material advantage and unstoppable queenside passed pawns. Black has an advanced passed pawn of his own, but it won't be easy to force through. For example if at some point Black plays ...e1=Q, White responds with Rxe1 Nxe1 Rxe1 Qxe1 a8=Q, then White has a decisive material advantage. So in the current position, White is winning, and Black's best hope is to find some kind of perpetual check.
- Rg1
Forced move. Should be pretty obvious, since White has nowhere else to put the rook.
1...Nf2+ 2. Kh2
Only legal move.
2...Qe4
This move threatens a draw. It's not obvious how it does so, but we'll see more of this later.
- a7 Kh7
These moves seem innocuous, but they actually matter. 3. a7 interferes with Black's threat because 4. a8=Q+ forces 4...Qxa8, which leaves White with a decisive material advantage. Accordingly, Black gets out of the upcoming promotion with check.
Now we examine what Black's threat actually is. To do this let's assume White passes with no play.
- -- e1=Q! 5. Rbxe1 (Rgxe1 is similar, while 5. a8=Q?? hoping for 5...Qxa8?? loses the game after 5...Q1xb1 6. Rxb1 Qxa8.) Qf4+ 6. g3 Qd2.
Black threatens 7...Ng4+ 8. Kh1 Qh2#. White can stop the mate, but cannot stop the perpetual. Let's check out an attempt to do so. 7. Kg2. Only move. 7. Rg2?? Qxe1 8. a8=Q Qh1#. 7...Nd3+ 8. Kf3?? (8. Kh1 Nf2+ 9. Kg2 Nd3+ is a draw by perpetual) 8...Nxe1+ 9. Rxe1 Qxe1 and Black wins because 10. a8=Q is met by 10...Qh1+ skewering the queen.
[FEN "8/P4ppk/7p/1N6/1P2q3/2P4P/4pnPK/1R4R1 b - - 1 4"]
1...e1=Q 2. Rbxe1 Qf4+ 3. g3 Qd2 4. Kg2 Nd3+ 5. Kf3 Nxe1+ 6. Rxe1 Qxe1 7. a8=Q Qh1+
Hence the puzzle has White play 4. Nd4. Now if Black goes for 4...e1=Q 5. Rbxe1 Qf4+ 6. g3 Qd2, White has 7. Re2 (Rook is defended by Knight), winning.