#include <bits/stdc++.h>
using namespace std;
const int di[] = {-1, 0, 1, 0};
const int dj[] = {0, 1, 0, -1};
const long long MOD = 1e9 + 7;
const long long INF = 1e9;
int n, m;
vector<int> num;
vector<int> mem(5002, -1);
int LNDSubSquence(int idx) {
  if (mem[idx] != -1) return mem[idx];
  int ret = 0;
  for (int i = idx + 1; i < n; i++)
    if (num[i] >= num[idx]) ret = max(ret, LNDSubSquence(i));
  return mem[idx] = ret + 1;
}
int main() {
  ios::sync_with_stdio(false), cin.tie(0);
  cin >> n >> m;
  n++;
  num.resize(n);
  num[0] = 0;
  for (int i = 1; i < n; i++) {
    double x;
    cin >> num[i] >> x;
  }
  cout << n - LNDSubSquence(0) << endl;
  cin.ignore(), cin.get();
}
