include [HTML_REMOVED]
include [HTML_REMOVED]
include [HTML_REMOVED]
using namespace std;
const int N = 10000;
int L, n;
int main()
{
bool a[N];
int count = 0;
cin >> L >> n;
for(int i = 0; i <= L; i) a[i] = true;
while(n–)
{
int c, d;
cin >> c >> d;
for(int i = c; i <= d; i)
{
a[i] = false;
}
}
for(int i = 0; i <= L; i++)
{
count += a[i];
}
cout << count;
}