(You may cast a legendary sorcery only if you control a legendary creature or planeswalker.)
Look at the top X cards of your library. You may put any number of land and/or legendary permanent cards with mana value X or less from among them onto the battlefield. Put the rest into your graveyard.