#include <bits/stdc++.h>
using namespace std;
long long bin(long long x, long long n) {
  long long res = 1;
  x %= 1000000007;
  while (n) {
    if (n & 1) res = (res * x) % 1000000007;
    x = (x * x) % 1000000007;
    n >>= 1;
  }
  return res;
}
void solve() {
  long long n, m;
  cin >> n >> m;
  long long x;
  double y;
  vector<long long> v, dp(n, 0);
  for (long long i = 0; i < n; i++) {
    cin >> x >> y;
    v.push_back(x);
  }
  long long mx = 0;
  for (long long i = 0; i < n; i++) {
    for (long long j = 0; j < i; j++) {
      if (v[j] <= v[i]) dp[i] = max(dp[i], dp[j] + 1);
    }
    mx = max(mx, dp[i]);
  }
  cout << n - mx - 1 << '\n';
}
signed main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  long long t = 1;
  for (long long i = 1; i <= t; i++) {
    solve();
  }
}
