1. The integers $1,2, \cdots$, n can be arranged such that each number is either greater than all the numbers before it or less than all the numbers before it. How many such arrangements are there?
1. Let the number of permutations be denoted as $a_{n}$, then $a_{1}=1$. For $n \geqslant 2$, if the number $n$ is placed at the $i$-th position, then the $n-i$ numbers after it are completely determined (they can only be $n-i, n-i-1, \cdots, 1$). The $i-1$ numbers before it have $a_{i-1}$ ways of being arranged, hence we get $a_{n}=1+a_{1}+\cdots+a_{n-1}$. From this, it is easy to prove by induction that $a_{n}=2^{n-1}$.