#include <bits/stdc++.h>
using namespace std;
const int maxn = 100010;
int n, m;
struct node {
  int kind;
  double pos;
} a[maxn];
int dp[maxn];
int main() {
  cin >> n >> m;
  for (int i = 1; i <= n; ++i) {
    cin >> a[i].kind >> a[i].pos;
    dp[i] = 1;
  }
  int ans = 0;
  for (int i = 1; i <= n; ++i) {
    for (int j = 1; j < i; ++j) {
      if (a[i].kind >= a[j].kind) {
        dp[i] = max(dp[i], dp[j] + 1);
      }
    }
    ans = max(ans, dp[i]);
  }
  cout << n - ans;
  return 0;
}
