Provided herein are compounds of the formulas (I) and (II): as well as pharmaceutically acceptable salts thereof, wherein the substituents are as those disclosed in the specification. These compounds, and the pharmaceutical compositions containing them, are useful for the treatment of Retinoic Acid Receptor-Related Orphan Receptor regulated diseases and disorders.