#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  int m;
  cin >> n >> m;
  int *N = new int[n];
  int *M = new int[n];
  for (int i = 0; i < n; i++) {
    double temp;
    cin >> N[i] >> temp;
    M[i] = 1;
  }
  for (int i = 0; i < n; i++) {
    for (int j = i - 1; j >= 0; j--) {
      if ((N[i] >= N[j]) && (M[j] + 1 > M[i])) M[i] = M[j] + 1;
    }
  }
  int max = 0;
  for (int i = 0; i < n; i++) {
    if (M[i] > max) max = M[i];
  }
  cout << n - max << endl;
  return 0;
}
