Provided herein are compounds of the formula I: 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 or prevention of mGluR5 mediated disorders, such as acute and/or chronic neurological disorders, cognitive disorders and memory deficits, as well as acute and chronic pain.