#include <bits/stdc++.h>
using namespace std;
int main() {
  int nb = 30;
  ios::sync_with_stdio(0);
  cin.tie(0);
  int n, m;
  cin >> n >> m;
  int kinds[n];
  double locs[n];
  for (int i = 0; i < n; i++) {
    cin >> kinds[i] >> locs[i];
  }
  int dp[n];
  int res = 1;
  for (int i = n - 1; i >= 0; i--) {
    int val = 1;
    for (int j = i + 1; j < n; j++) {
      if (kinds[j] >= kinds[i]) {
        val = max(val, 1 + dp[j]);
      }
    }
    dp[i] = val;
    res = max(res, val);
  }
  cout << (n - res) << endl;
}
