The entries in a certain row of Pascal's triangle are \[1, n, \dots, n, 1.\] The average of the entries in this row is 2. Find $n$.