#include <bits/stdc++.h>
const long long MXN = 3e6 + 3;
const long long MNN = 1e3 + 1;
const long long MOD = 1e9 + 7;
const long long INF = 1e18;
const long long OO = 1e9 + 500;
using namespace std;
int n, mx = 1, b[MXN], dp[MXN], m;
double x;
int main() {
  ios_base::sync_with_stdio(0), cout.tie(0), cin.tie(0);
  ;
  cin >> n >> m;
  for (int i = 1; i <= n; i++) {
    cin >> b[i] >> x;
    dp[i] = 1;
    for (int j = 1; j < i; j++) {
      if (b[j] <= b[i]) {
        dp[i] = max(dp[i], dp[j] + 1);
        mx = max(dp[i], mx);
      }
    }
  }
  cout << n - mx;
  return 0;
}
