/*
* * author: attacker
* * created: 21.02.2026 18:18:22
*/
#include <bits/stdc++.h>
using namespace std;
#ifdef LOCAL
#include "algo/debug.h"
#else
#define debug(...) 42
#endif
#define mt_rng mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
int main() {
ios_base::sync_with_stdio(false);
cin.tie(nullptr);
cout.tie(nullptr);
int n, k;
cin >> n >> k;
vector<int> vt;
vt.push_back(n);
for (int i = 0; i < k; i++) {
int x, l;
cin >> x >> l;
--x;
int val = vt[x];
vt.erase(vt.begin() + x);
vt.insert(vt.begin() + x, l);
vt.insert(vt.begin() + x + 1, val - l);
}
set<int> s(vt.begin(), vt.end());
cout << int(s.size()) << '\n';
return 0;
}