E: I assumed that the answer is either at most N or infinity. Why is this true?
G: Is there a solution that doesn't require reading papers (or at least reading the wikipedia article mentioned in the statement)? I heard that there's a paper that describes the solution.