#include <bits/stdc++.h>
using namespace std;
long n, m, tp[200000];
double dou;
long ans[20000];
long answ;
int main() {
  cin >> n >> m;
  for (int i = 1; i <= n; i++) cin >> tp[i] >> dou;
  for (int i = 1; i <= n; i++) {
    ans[i] = 1;
  }
  for (int i = 1; i <= n; i++) {
    for (int j = i + 1; j <= n; j++) {
      if (tp[j] >= tp[i]) ans[j] = max(ans[j], ans[i] + 1);
    }
  }
  answ = 0;
  for (int i = 1; i <= n; i++) answ = max(answ, ans[i]);
  cout << n - answ << endl;
  cin.get();
  cin.get();
  return 0;
}
