The dynamics of metric-affine gravity