#include <bits/stdc++.h>
using namespace std;
int a[200000], dp[600000];
int main() {
  int n, l;
  cin >> n >> l;
  for (int i = 1; i <= n; i++) {
    double x;
    cin >> a[i] >> x;
  }
  int maxx = -1;
  for (int i = 1; i <= n; i++) {
    dp[i] = 1;
    for (int j = 1; j < i; j++) {
      if (a[i] >= a[j]) dp[i] = max(dp[i], dp[j] + 1);
      maxx = max(maxx, dp[i]);
    }
  }
  if (n == 1)
    cout << 0 << endl;
  else
    cout << n - maxx << endl;
}
