#include <bits/stdc++.h>
int v[101], i, j, c, n;
int main() {
  for (; ~scanf("%d\n", &n); n && printf("%d\n", c))
    for (c = i = 0; j < i || i < n && (j = scanf("%d\n", ++i + v));)
      c += v[j++] > v[i];
}
