The life that’s lost and the life that’s gained are based on the number of cards that are actually exiled, not on the value of X (in case any of the targeted cards somehow leave the graveyard in response and thus can’t be exiled this way).