N \leq 1000