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