The present invention relates to compounds of formula wherein Ar, Het, R1 and n are as defined herein and to pharmaceutically suitable acid addition salts, optically pure enantiomers, racemates or diastereomeric mixtures thereof. Compounds of formula I are orexin receptor antagonists and are useful in the treatment of sleep apnea, narcolepsy, insomnia, parasomnia, jet lag syndrome, circadian rhythms disorder and sleep disorders associated with neurological diseases.