Estimate of the distance to the solar wind termination shock from gradients of anomalous cosmic ray oxygen