You read the wrong position from the array Z: R^2 is in Z(3,1) and not in Z(2,1).
Z
R^2
Z(3,1)
Z(2,1)