People are numbered to , not to . You have two options: create arrays of size and use indices to (index stays unused), or subtract from all person numbers to make them -indexed, then use arrays of size .
Both work. The first is simpler to think about. Remember your loop bounds: iterate from to , not to . Off-by-one errors are common here.