Off-by-one error
The correct answer may be n − 1, n, or n + 1, depending on the conditions. The precise problem definition must be carefully considered, as the setup for one situation may give the wrong answer for other situations.  Fencepost errors come from counting things rather than the spaces between them, or vice versa, or by neglecting to consider whether one should count one or both ends of a row.