  We introduce certain rational functions on a smooth projective surface X in
IP^3 which facilitate counting the lines on X. We apply this to smooth quintics
in characteristic zero to prove that they contain no more than 127 lines, and
that any given line meets at most 28 others. We construct examples which
demonstrate that the latter bound is sharp.
