SHARPS: The key is always on the letter alphabetically above the farthest sharp on the right at a distance of one half step. If there are no sharps or flats, it is the key of C.
FLATS: The key is equal to the second flat from the right. Since the key of F has only one flat (Bb) it must be memorized.
If you don't have Javascript enabled you can see all the key signatures in HTML