Skyscraper Rules

Put a number between 1 and n (the grid size), into each gridcell such that each number appears exactly once in each row and column. If the numbers represent heights of buildings, the numbers outside the grid tell the number of visible buildings from that point looking into the grid, with higher buildings block lower ones in visibility.  (I hope that is understandable, see example)