#include <bits/stdc++.h>
using namespace std;
long long lis(long long arr[], long long n) {
  long long lis[n];
  lis[0] = 1;
  for (long long i = 1; i < n; i++) {
    lis[i] = 1;
    for (long long j = 0; j < i; j++)
      if (arr[i] >= arr[j] && lis[i] < lis[j] + 1) lis[i] = lis[j] + 1;
  }
  return *max_element(lis, lis + n);
}
void solve() {
  long long n, m;
  cin >> n >> m;
  long long a[n];
  double d[n];
  for (long long i = 0; i < (n); ++i) cin >> a[i] >> d[i];
  cout << n - lis(a, n);
}
signed main() {
  std::ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  long long t;
  t = 1;
  while (t--) {
    solve();
  }
  return 0;
}
