#include <bits/stdc++.h>
using namespace std;
template <typename T>
T gcd(T a, T b) {
  if (a == 0) return b;
  return gcd(b % a, a);
}
template <typename T>
T pow(T a, T b, long long m) {
  T ans = 1;
  while (b > 0) {
    if (b % 2 == 1) ans = (ans * a) % m;
    b /= 2;
    a = (a * a) % m;
  }
  return ans % m;
}
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  ;
  int n, m;
  cin >> n >> m;
  int ans = 0;
  int a[n];
  float crd;
  int dp[n];
  for (int i = 0; i < n; i++) {
    cin >> a[i] >> crd;
  }
  for (int i = 0; i < n; i++) dp[i] = 1;
  for (int i = 0; i < n; i++) {
    for (int j = i - 1; j >= 0; j--) {
      if (a[i] >= a[j] && dp[i] < (dp[j] + 1)) dp[i] = dp[j] + 1;
    }
  }
  for (int i = 0; i < n; i++) {
    ans = max(ans, dp[i]);
  }
  cout << (n - ans);
}
