Such a function would be conformal, and these functions are known to be linear if $n\geq3$. In dimension two, you obtain functions which are either holomorphic or antiholomorphic.