On Grubler's formulae for mechanisms