Planck 2013 results. XX. Cosmology from Sunyaev-Zeldovich cluster counts