only compare until MIN(2, count) when scanning the input buffer