Answer: 6 stages
Explanation
-340 = starting depth
n = number of stages
60n = total vertical displacement, i.e. how much you move up
-340+60n = final depth after moving n stages (each stage 60 meters)
Set this equal to zero and solve for n.
-340+60n = 0
60n = 340
n = 340/60
n = 5.667 approximately
n = 6 is the final answer
----------
If 5 stages were done, then the depth would be
-340+60n = -340+60*5 = -40
Meaning that you would still be underwater at a depth of 40 meters below the surface.
If 6 stages are done, then,
-340+60n = -340+60*6 = 20
At this point the depth is 20 meters above the surface. Of course the submarine cannot hover or fly. So at this point we would set the depth to 0 instead.
This shows that 5 stages aren't enough, but 6 stages are enough to return to the surface. The last stage will cover 40 meters instead of 60 meters.
So this is why we round the n = 5.667 to n = 6