What you need is the theory of record values. $X_1, X_2, \dots, X_n, \dots$ are i.i.d. random variables, with an absolutely continuous distribution with density function $f$. Define the binary variables
$$
I_i = \begin{cases} 1, \text{$i$ is a record time} \\
0, \text{$i$ is not a record time}.
\end{cases}
$$
that is, $I_i=1$ if $X_1<x_i, X_2<X_i, \dots, X_{i-1}<X_i$. Since we have assumed an absolutely continuos distribution, we can disregard the possibility of equality, which have probability zero. Now,
$$
P(I_i=1)=1/i,
$$
since the maximum among the first $i$ observations must have equal probability of occuring at any of the $i$ times $1,2, \dots, i$. Next, somewhat surprisingly, the process $I_1, I_2, \dots $ is independent, since the probability that $j$ will be a new record time cannot in any way depend on the ordering among the first $j-1$ observations! So, letting $N_n=I_1+I_2+\dots+I_n$ be the number of records among the first $n$ observations, we get
$$
E N_n = \frac 11+\frac12+\frac13+\dots+\frac1n=H_n
$$
the $n$th harmonic number, and the variance is
$$
\text{Var}(N_n) = 1\cdot(1-1)+\frac12(1-\frac12)+\frac13(1-\frac13)+\dots+\frac1n(1-\frac1n).
$$
For (much) more about this theory of record values, see the book by Arnold et.al.: "A First Course in Order Statistics" (Calssics in Applied Mathematics), chapter 9.