Yes, they are two different torques! There are 3 torques in this problem in total, and if you put the origin of your coordinate system on top of one of them you will eliminate it from the sum of all torques.
Both the torques in question here are acting at the same time to opposite the applied 4N force (which creates the third torque), but depending on how you choose your axis you can get the one you don't care about (isn't asked about) to disappear. When you choose your origin, any torques through that point do not show up in your sum of all torques because the distance from the "axis of rotation" you are choosing is zero, and the torque due to any force is Force times Distance from Axis. In that way, you end up making whatever torques go through that point disappear. In other words, if you have a door attached to a hinge, and you press on the door, it will swing due to torque producing angular acceleration. If you press really hard in the same direction right on the hinge, the door won't move because while F > 0, the distance from the axis of rotation equals zero, therefore the torque ends up being zero and the door won't rotate around the hinge.
You're doing the mathematical equivalent of that in this problem when you choose to analyze the system from the end of board Y. That 12N force IS at that point the whole time, but it produces no torque because it goes through the axis of rotation of board Y (i.e. the center of our coordinate system).
However, if we move our coordinate system and "assume" our board is rotating around the nail, we can get the nail torque to go to zero and calculate the torque at the edge of the board instead (12N).
The lesson here is this: If you're trying to calculate a torque, DON'T choose your coordinate system origin to be at the point you care about (which is opposite of advice that works for most other physics problems) otherwise you'll be getting an equation for every torque EXCEPT the one you care about.
Also, consider this: If someone/something is applying at 4N force to the free end of board Y, and the friction force is 16N, why isn't board Y accelerating? After all, if a system is in static equilibrium, the sum of all torques AND forces must be zero. So you would expect that if the only two forces acting on the board were the 4N push and the 16N of friction, you'd expect the board to experience an accelerating force of 12N. Since the board isn't moving, we know there MUST be another 12N force opposing the motion of the board. So it's not coincidence that we calculated 12N to be the force at the edge of board Y. That's the force of the rigid board X pushing back against board Y when someone tries to lift the edge of board Y (4N) while they're nailed together.