#include <bits/stdc++.h>
static const long long INF = 1 << 25;
using namespace std;
long long dfs() {}
long long dp[100010], a[100010];
signed main() {
  long long n;
  cin >> n;
  for (long long i = 1; i <= n; i++) {
    cin >> a[i];
  }
  dp[a[1]] = 1;
  long long ans = -INF;
  long long cnt = 0;
  for (long long i = 1; i <= n; i++) {
    cnt = 0;
    for (long long j = i + 1; j <= n; j++) {
      if (a[i] < a[j]) cnt++;
    }
    if (cnt == 0) cnt = 1;
    if (ans < cnt) ans = cnt;
  }
  cout << ans << endl;
}
