#include <bits/stdc++.h>
using namespace std;
int s[5010];
double x[5010];
int dp[5010];
int main() {
  int n, m;
  scanf("%d %d", &n, &m);
  for (int i = 0; i < n; i++) scanf("%d %lf", &s[i], &x[i]);
  s[n] = 1000000010;
  dp[0] = 1;
  for (int i = 1; i <= n; i++) {
    dp[i] = 1;
    for (int j = 0; j < i; j++)
      if (s[j] <= s[i]) dp[i] = max(dp[i], dp[j] + 1);
  }
  printf("%d\n", n + 1 - dp[n]);
  return 0;
}
