#include <bits/stdc++.h>
using namespace std;
int main() {
  long long int t, i, j, n, m;
  cin >> n >> m;
  double k;
  int a[n], dp[n];
  for (i = 0; i < n; i++) {
    cin >> a[i] >> k;
  }
  for (i = 0; i < n; i++) dp[i] = 1;
  for (i = 1; i < n; i++) {
    for (j = 0; j < i; j++) {
      if (a[i] >= a[j] && dp[i] < dp[j] + 1) dp[i] = dp[j] + 1;
    }
  }
  int mx = *max_element(dp, dp + n);
  cout << n - mx;
  return 0;
}
