Typing a number followed by a carriage return will bring you to that line number in the file. Hence, to go to the top of the file, type
1
To go to line 5 of the file, type
5
To go up num lines, type
-num
To go down num lines, type
+num
If ed can't get you to that line, it will respond with a