Use int8_t instead of int for SquareDistance[]