Alternatively, you could add or subtract an offset of around 16~17 to the result of analogRead(), and then use map() to get one of 32 values. You would then have to adjust the result by one to compensate for the original offset. The advantage is using the offset is that it should remove the problem of the uncertainty in the resistor values, as long as the errors in the resistors values are reasonably random.
int result = map( analogRead(A1), -16, 1007, 1, 32);