(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 converted mana cost x or less from among them onto the battlefield. put the rest into your graveyard.