stablegradients/pie-gem5-pairs huggingface dataset:
// Slower C++ solution:
#include<cstdio>

#include<cmath>

#include<algorithm>

#include<cctype>

#include<cstring>

#include<queue>

#include<iostream>

#include<map>

using namespace std;

typedef long long ll;

typedef double lf;

typedef unsigned un;

typedef int in;

#define mian main

#define maxn 10000+10

#define maxm 10000+10

#define _(a) read(a)

#define non void

#define inf 2147483647

#define bre break

#define con continue

#define prq priority_queue

#define re register

#define bu bool

#define cz char

#define cst const

#define ope operator

#define inl inline

#define upp upper_bound

#define low lower_bound

#define next_per next_permutation

inl cz gc(){static cz buf[100000],*L=buf,*R=buf;return L==R&&(R=(L=buf)+fread(buf,1,100000,stdin),L==R)?EOF:*L++;}

template<typename T>inl T Max(T a,T b){return a>b?a:b;}

template<typename T>inl T Min(T a,T b){return a<b?a:b;}

template<typename T>inl T Abs(T a){return a<0?-a:a;}

template<typename T>inl non read(T &a){a=0;T k=1;char c=gc();while(c<'0'||c>'9')k=c=='-'?-1:k,c=gc();while(c>='0'&&c<='9')a=a*10+(c^48),c=gc();if(c!='.'){a*=k;return;}T t=0.1;while(c<'0'||c>'9')c=gc();while(c>='0'&&c<='9')a+=t*(c^48),c=gc(),t*=0.1;a*=k;}

template<typename T>non write(T a,cz t='\n'){if(a==0){putc(48,stdout),putc(t,stdout);return;}if(a<0){a=-a;putc('-',stdout);}cz c[30];in le=0;while(a){c[++le]=a%10+48;a/=10;}for(re in i=le;i>=1;--i)putc(c[i],stdout);putc(t,stdout);}

in n,l,r,sum;

in main()

{

	read(n);

	for(re in i=1;i<=n;++i)read(l),read(r),sum+=r-l+1;

	write(sum);

	//freopen(".in","r",stdin);

	//freopen(".out","w",stdout);

}


// Faster C++ solution for the same problem (measured speedup: 5.13676532757362x):
#include<cstdio>

using namespace std; 

int main(){

	int n;

	scanf("%d",&n);

	int ans=0;

	while(n--){

		int a,b;

		scanf("%d%d",&a,&b);

		ans=ans+b-a+1;

	}

	printf("%d\n",ans);

}
// Slower C++ solution:
#include <iostream>

using namespace std;

int main()

{

	int n;

	cin>>n;

	int ans=0;

	int ai,bi;

	for (int i=1;i<=n;i++)

	{

		cin>>ai>>bi;

		ans+=(bi-ai+1);

	}

	cout<<ans;

	return 0;

}

// Faster C++ solution for the same problem (measured speedup: 5.228803974185851x):
#include<cstdio>

using namespace std; 

int main(){

	int n;

	scanf("%d",&n);

	int ans=0;

	while(n--){

		int a,b;

		scanf("%d%d",&a,&b);

		ans=ans+b-a+1;

	}

	printf("%d\n",ans);

}
// Slower C++ solution:
#include<bits/stdc++.h>

using namespace std;

int main()

{

	int ans=0;

	int l,r;

	int n;

	cin>>n;

	for(int i=1;i<=n;i++)

	{

		scanf("%d%d",&l,&r);

		ans+=r-l+1;

	}

	cout<<ans<<endl;

	return 0;

}

// Faster C++ solution for the same problem (measured speedup: 5.24996213319812x):
#include<cstdio>

using namespace std; 

int main(){

	int n;

	scanf("%d",&n);

	int ans=0;

	while(n--){

		int a,b;

		scanf("%d%d",&a,&b);

		ans=ans+b-a+1;

	}

	printf("%d\n",ans);

}
// Slower C++ solution:
#include<bits/stdc++.h>

using namespace std;

int main()

{

	int n,x,y,ans=0,i;

	cin>>n;

	for (i=1;i<=n;i++)

	{

		cin>>x>>y;

		ans+=(y-x+1);

	}

	cout<<ans;

}

// Faster C++ solution for the same problem (measured speedup: 5.228803974185851x):
#include<cstdio>

using namespace std; 

int main(){

	int n;

	scanf("%d",&n);

	int ans=0;

	while(n--){

		int a,b;

		scanf("%d%d",&a,&b);

		ans=ans+b-a+1;

	}

	printf("%d\n",ans);

}
// Slower C++ solution:
#include <bits/stdc++.h>

using namespace std;

int n;

int li,ri,ans;

int main()

{

    cin>>n;

    for(int i=1;i<=n;i++)

	{

        cin>>li>>ri;

        ans+=ri-li+1;

    }

    cout<<ans<<endl;

}

// Faster C++ solution for the same problem (measured speedup: 5.236909742790725x):
#include<cstdio>

using namespace std; 

int main(){

	int n;

	scanf("%d",&n);

	int ans=0;

	while(n--){

		int a,b;

		scanf("%d%d",&a,&b);

		ans=ans+b-a+1;

	}

	printf("%d\n",ans);

}
// Slower C++ solution:
#include<iostream>

#include<cstdio>

#include<cstring>

#include<algorithm>

using namespace std;

int main()

{

	int n,sum=0;

	scanf("%d",&n);

	int l,r;

	for(int i=1;i<=n;i++)

	{

		scanf("%d%d",&l,&r);

		sum+=r-l+1;

	}

	printf("%d",sum);

	return 0;

}

// Faster C++ solution for the same problem (measured speedup: 5.169341517127486x):
#include<cstdio>

using namespace std; 

int main(){

	int n;

	scanf("%d",&n);

	int ans=0;

	while(n--){

		int a,b;

		scanf("%d%d",&a,&b);

		ans=ans+b-a+1;

	}

	printf("%d\n",ans);

}
// Slower C++ solution:
#include<bits/stdc++.h>

using namespace std;

int l[100000],r[100000];

int main() {

	int n,i,sum=0;

	cin>>n;

	for(i=0;i<n;i++){

		cin>>l[i]>>r[i];

	}

	for(i=0;i<n;i++){

		sum+=r[i]-l[i]+1;

	}

	cout<<sum;

	return 0;

}

// Faster C++ solution for the same problem (measured speedup: 5.228822925344623x):
#include<cstdio>

using namespace std; 

int main(){

	int n;

	scanf("%d",&n);

	int ans=0;

	while(n--){

		int a,b;

		scanf("%d%d",&a,&b);

		ans=ans+b-a+1;

	}

	printf("%d\n",ans);

}
// Slower C++ solution:
#include<bits/stdc++.h>

using namespace std;

long long n,l,r,s;   

int main()

{

    cin>>n;

    for(int i=1;i<=n;i++)

    {

        cin>>l>>r;

        s+=r-l+1;    

    }

    cout<<s<<endl;

    return 0;

}

 

// Faster C++ solution for the same problem (measured speedup: 5.232710910415088x):
#include<cstdio>

using namespace std; 

int main(){

	int n;

	scanf("%d",&n);

	int ans=0;

	while(n--){

		int a,b;

		scanf("%d%d",&a,&b);

		ans=ans+b-a+1;

	}

	printf("%d\n",ans);

}
// Slower C++ solution:
#include<iostream>

#include<cstdio>

#include<cmath>

#include<algorithm>

#include<string>

#include<cstring>

#include<cstdlib>

using namespace std;

long long a,b,n,ans;

int main()

{

  scanf("%lld",&n);

  for(int i=0;i<n;i++)

  {

    scanf("%lld%lld",&a,&b);

    ans+=b-a+1;

  }

  printf("%lld\n",ans);

  return 0;

}


// Faster C++ solution for the same problem (measured speedup: 5.168287426400533x):
#include<cstdio>

using namespace std; 

int main(){

	int n;

	scanf("%d",&n);

	int ans=0;

	while(n--){

		int a,b;

		scanf("%d%d",&a,&b);

		ans=ans+b-a+1;

	}

	printf("%d\n",ans);

}
// Slower C++ solution:
#include <bits/stdc++.h>

using namespace std;

int main(){

    int n;

    int l,r,ans;

    cin>>n;

    for(int i=1;i<=n;i++){

        cin>>l>>r;

        ans+=r-l+1;

    }

    cout<<ans<<endl;

}

// Faster C++ solution for the same problem (measured speedup: 5.23539666181731x):
#include<cstdio>

using namespace std; 

int main(){

	int n;

	scanf("%d",&n);

	int ans=0;

	while(n--){

		int a,b;

		scanf("%d%d",&a,&b);

		ans=ans+b-a+1;

	}

	printf("%d\n",ans);

}
// Slower C++ solution:
#include<iostream>

using namespace std;

int main(){

	int n, i, sum = 0, a, b;

	cin >> n;

	for(i = 0; i < n; i++){

		cin >> a >> b;

		sum += (b-a+1);

	}

	cout << sum << endl;

	return 0;

} 

// Faster C++ solution for the same problem (measured speedup: 5.229717176543942x):
#include<cstdio>

using namespace std;

int main()

{

    int n;

    long long int a,b;

    long long int sum=0;

    scanf("%d",&n);

    for(int i=1;i<=n;i++)

    {

        scanf("%lld %lld",&a,&b);

        sum+=(b-a+1);

    }

    printf("%lld\n",sum);

}
// Slower C++ solution:
#include<cstdio>

#include<iostream>

using namespace std;

int a[100000],b[100000];

int main()

{

	int n,x=0;

	cin>>n;

	for(int i=0;i<n;i++)

	   cin>>a[i]>>b[i];

	for(int j=0;j<n;j++)

	{

		x+=b[j]-a[j];

	}

	cout<<x+n<<endl;

	return 0;

} 

// Faster C++ solution for the same problem (measured speedup: 5.229634114719038x):
#include<cstdio>

using namespace std;

int main()

{

    int n;

    long long int a,b;

    long long int sum=0;

    scanf("%d",&n);

    for(int i=1;i<=n;i++)

    {

        scanf("%lld %lld",&a,&b);

        sum+=(b-a+1);

    }

    printf("%lld\n",sum);

}
// Slower C++ solution:
#include <iostream>



using namespace std;



int main(){



    int n;

    int l,r;

    int sum = 0;

    cin >> n;

    for(int i=0;i<n;i++){

        cin >> l >> r;

        sum += (r-l+1);

    }

    cout << sum << endl;

    return 0;

}


// Faster C++ solution for the same problem (measured speedup: 5.229895902090303x):
#include<cstdio>

using namespace std;

int main()

{

    int n;

    long long int a,b;

    long long int sum=0;

    scanf("%d",&n);

    for(int i=1;i<=n;i++)

    {

        scanf("%lld %lld",&a,&b);

        sum+=(b-a+1);

    }

    printf("%lld\n",sum);

}
// Slower C++ solution:
#include<bits/stdc++.h>

using namespace std;

int a,b,c;

int z;

int main()

{

	cin>>a;

	for (int i=1;i<=a;i++)

	{

		cin>>b>>c;

		z=z+(c-b+1);

	}

	cout<<z<<endl;

	return 0;

}

// Faster C++ solution for the same problem (measured speedup: 5.248598127674135x):
#include<cstdio>

int n,l,r,ans;

int main(){

	scanf("%d",&n);

	while(n--)

		scanf("%d%d",&l,&r),ans+=r-l+1;

	printf("%d\n",ans);

	return 0;

}
// Slower C++ solution:
#include<bits/stdc++.h>

using namespace std;

inline int read()

{

    int num = 0;

    char c;

    bool flag = false;

    while ((c = getchar()) == ' ' || c == '\n' || c == '\r');

        if (c == '-') flag = true;

    else

        num = c - '0';

    while (isdigit(c = getchar()))

    num = num * 10 + c - '0';

    return (flag ? -1 : 1) * num;

}

int main()

{

	int n,a,b,sum=0;

	n=read();

	for(int i=1;i<=n;i++)

	{

		a=read();

		b=read();

		sum+=b-a+1;

	}

	cout<<sum<<endl;

	return 0;

}




// Faster C++ solution for the same problem (measured speedup: 5.184036737913904x):
#include<cstdio>

int n,l,r,ans;

int main(){

	scanf("%d",&n);

	while(n--)

		scanf("%d%d",&l,&r),ans+=r-l+1;

	printf("%d\n",ans);

	return 0;

}
// Slower C++ solution:
#include<bits/stdc++.h>

using namespace std;

int a,b,c,d;

int main(){

    cin>>a;

    for (int i=1;i<=a;++i){

        cin>>b>>c;

        d+=c-b+1;

    }

    cout<<d<<endl;

    return 0;

}

// Faster C++ solution for the same problem (measured speedup: 5.248598127674135x):
#include<cstdio>

int n,l,r,ans;

int main(){

	scanf("%d",&n);

	while(n--)

		scanf("%d%d",&l,&r),ans+=r-l+1;

	printf("%d\n",ans);

	return 0;

}
// Slower C++ solution:
#include<bits/stdc++.h>

using namespace std;

int main(){

	int n,cnt=0,l,r;

	scanf("%d",&n);

	while(n--){

		scanf("%d%d",&l,&r);

		cnt+=r-l+1;

	}

	cout<<cnt<<endl;

	return 0;

}

// Faster C++ solution for the same problem (measured speedup: 5.202717011641439x):
#include<cstdio>

int n,l,r,ans;

int main(){

	scanf("%d",&n);

	while(n--)

		scanf("%d%d",&l,&r),ans+=r-l+1;

	printf("%d\n",ans);

	return 0;

}
// Slower C++ solution:
#include<iostream>

using namespace std;

int main()

{

	int n,a[10002],b[10002],ans=0;

	cin>>n;

	for(int i=1;i<=n;i++)

	{

		cin>>a[i]>>b[i];

	}

	for(int i=1;i<=n;i++)

	{

		ans+=b[i]-a[i]+1;

	}

	cout<<ans;

	return 0;

}

// Faster C++ solution for the same problem (measured speedup: 5.240832464902148x):
#include<cstdio>

int n,l,r,ans;

int main(){

	scanf("%d",&n);

	while(n--)

		scanf("%d%d",&l,&r),ans+=r-l+1;

	printf("%d\n",ans);

	return 0;

}
// Slower C++ solution:
#include<bits/stdc++.h>

using namespace std;

int a,b,c;

int z;

int main()

{

	cin>>a;

	for (int i=1;i<=a;i++)

	{

		cin>>b>>c;

		z=z+(c-b+1);

	}

	cout<<z<<endl;

	return 0;

}

// Faster C++ solution for the same problem (measured speedup: 5.253971645886976x):
#include <cstdio>

#include <cstring>

#include <algorithm>

#include <cmath>

using namespace std;



int l, r, ans, n;

int main() {

	scanf("%d", &n);

	for(int i = 1; i <= n; ++i) {

		scanf("%d%d", &l, &r);

		ans += r - l + 1;

	}

	printf("%d", ans);

	return 0;

}
// Slower C++ solution:
#include<bits/stdc++.h>

using namespace std;

inline int read()

{

    int num = 0;

    char c;

    bool flag = false;

    while ((c = getchar()) == ' ' || c == '\n' || c == '\r');

        if (c == '-') flag = true;

    else

        num = c - '0';

    while (isdigit(c = getchar()))

    num = num * 10 + c - '0';

    return (flag ? -1 : 1) * num;

}

int main()

{

	int n,a,b,sum=0;

	n=read();

	for(int i=1;i<=n;i++)

	{

		a=read();

		b=read();

		sum+=b-a+1;

	}

	cout<<sum<<endl;

	return 0;

}




// Faster C++ solution for the same problem (measured speedup: 5.1893441581334745x):
#include <cstdio>

#include <cstring>

#include <algorithm>

#include <cmath>

using namespace std;



int l, r, ans, n;

int main() {

	scanf("%d", &n);

	for(int i = 1; i <= n; ++i) {

		scanf("%d%d", &l, &r);

		ans += r - l + 1;

	}

	printf("%d", ans);

	return 0;

}
// Slower C++ solution:
#include<bits/stdc++.h>

using namespace std;

int a,b,c,d;

int main(){

    cin>>a;

    for (int i=1;i<=a;++i){

        cin>>b>>c;

        d+=c-b+1;

    }

    cout<<d<<endl;

    return 0;

}

// Faster C++ solution for the same problem (measured speedup: 5.253971645886976x):
#include <cstdio>

#include <cstring>

#include <algorithm>

#include <cmath>

using namespace std;



int l, r, ans, n;

int main() {

	scanf("%d", &n);

	for(int i = 1; i <= n; ++i) {

		scanf("%d%d", &l, &r);

		ans += r - l + 1;

	}

	printf("%d", ans);

	return 0;

}
// Slower C++ solution:
#include<bits/stdc++.h>

using namespace std;

int main(){

	int n,cnt=0,l,r;

	scanf("%d",&n);

	while(n--){

		scanf("%d%d",&l,&r);

		cnt+=r-l+1;

	}

	cout<<cnt<<endl;

	return 0;

}

// Faster C++ solution for the same problem (measured speedup: 5.20804355673753x):
#include <cstdio>

#include <cstring>

#include <algorithm>

#include <cmath>

using namespace std;



int l, r, ans, n;

int main() {

	scanf("%d", &n);

	for(int i = 1; i <= n; ++i) {

		scanf("%d%d", &l, &r);

		ans += r - l + 1;

	}

	printf("%d", ans);

	return 0;

}
// Slower C++ solution:
#include<iostream>

using namespace std;

int main()

{

	int n,a[10002],b[10002],ans=0;

	cin>>n;

	for(int i=1;i<=n;i++)

	{

		cin>>a[i]>>b[i];

	}

	for(int i=1;i<=n;i++)

	{

		ans+=b[i]-a[i]+1;

	}

	cout<<ans;

	return 0;

}

// Faster C++ solution for the same problem (measured speedup: 5.246198032624339x):
#include <cstdio>

#include <cstring>

#include <algorithm>

#include <cmath>

using namespace std;



int l, r, ans, n;

int main() {

	scanf("%d", &n);

	for(int i = 1; i <= n; ++i) {

		scanf("%d%d", &l, &r);

		ans += r - l + 1;

	}

	printf("%d", ans);

	return 0;

}
// Slower C++ solution:
#include<bits/stdc++.h>

using namespace std;

int n,l,r,ans;

int main(){

    cin>>n;

    for(int i=1;i<=n;i++){

        cin>>l>>r;

        ans+=r-l+1;

    }

    cout<<ans<<endl;

}

// Faster C++ solution for the same problem (measured speedup: 5.254030552336977x):
#include <cstdio>

#include <cstring>

#include <algorithm>

#include <cmath>

using namespace std;



int l, r, ans, n;

int main() {

	scanf("%d", &n);

	for(int i = 1; i <= n; ++i) {

		scanf("%d%d", &l, &r);

		ans += r - l + 1;

	}

	printf("%d", ans);

	return 0;

}
// Slower C++ solution:
#include<bits/stdc++.h>

using namespace std;

int n,l,r,ans,i;

int main(){

	scanf("%d",&n);

	for(i=1;i<=n;i++){

		scanf("%d%d",&l,&r);

		ans+=r-l+1;

	}

	printf("%d",ans);

	return 0;

}

// Faster C++ solution for the same problem (measured speedup: 5.185544528202236x):
#include <cstdio>

#include <cstring>

#include <algorithm>

#include <cmath>

using namespace std;



int l, r, ans, n;

int main() {

	scanf("%d", &n);

	for(int i = 1; i <= n; ++i) {

		scanf("%d%d", &l, &r);

		ans += r - l + 1;

	}

	printf("%d", ans);

	return 0;

}
// Slower C++ solution:
#include<bits/stdc++.h>

using namespace std;

int main(){

    int n;

    int l,r,ans=0;

    cin>>n;

    for(int i=1;i<=n;i++){

        cin>>l>>r;

        ans+=r-l+1;

    }

    cout<<ans<<endl;

}

// Faster C++ solution for the same problem (measured speedup: 5.2523872861494905x):
#include <cstdio>

#include <cstring>

#include <algorithm>

#include <cmath>

using namespace std;



int l, r, ans, n;

int main() {

	scanf("%d", &n);

	for(int i = 1; i <= n; ++i) {

		scanf("%d%d", &l, &r);

		ans += r - l + 1;

	}

	printf("%d", ans);

	return 0;

}
// Slower C++ solution:
#include<bits/stdc++.h>

using namespace std;

int main()

{

	int l,r;

	int n;

	cin>>n;

	int ans=0;

	for(int i=1;i<=n;i++)

	{

		cin>>l>>r;

		ans+=r-l+1;

	}

	cout<<ans<<endl;

}

// Faster C++ solution for the same problem (measured speedup: 5.2523872861494905x):
#include <cstdio>

#include <cstring>

#include <algorithm>

#include <cmath>

using namespace std;



int l, r, ans, n;

int main() {

	scanf("%d", &n);

	for(int i = 1; i <= n; ++i) {

		scanf("%d%d", &l, &r);

		ans += r - l + 1;

	}

	printf("%d", ans);

	return 0;

}
// Slower C++ solution:
#include <bits/stdc++.h>

using namespace std;

int n,a,b,ans;

int main()

{

    scanf("%d",&n);

    for(int i=1;i<=n;i++)

    {

    	scanf("%d%d",&a,&b);

    	ans+=b-a+1;

	}

	cout<<ans<<endl;

    return 0;

}

// Faster C++ solution for the same problem (measured speedup: 5.206615919798063x):
#include <cstdio>

#include <cstring>

#include <algorithm>

#include <cmath>

using namespace std;



int l, r, ans, n;

int main() {

	scanf("%d", &n);

	for(int i = 1; i <= n; ++i) {

		scanf("%d%d", &l, &r);

		ans += r - l + 1;

	}

	printf("%d", ans);

	return 0;

}
// Slower C++ solution:
#include<bits/stdc++.h>

using namespace std;

int n,l,r,ans;

int main()

{

	cin>>n;

	for(int i=1;i<=n;i++) 

	{

		cin>>l>>r;

		ans+=r-l+1;

	}

	cout<<ans;

	return 0;

}


// Faster C++ solution for the same problem (measured speedup: 5.245951646028363x):
#include <cstdio>

#include <cstring>

#include <algorithm>

#include <cmath>

using namespace std;



int l, r, ans, n;

int main() {

	scanf("%d", &n);

	for(int i = 1; i <= n; ++i) {

		scanf("%d%d", &l, &r);

		ans += r - l + 1;

	}

	printf("%d", ans);

	return 0;

}
// Slower C++ solution:
#include<bits/stdc++.h>

using namespace std;

int m,x,y,ans;

int main(){

	scanf("%d",&m);

	for(int i=1;i<=m;i++){

		scanf("%d%d",&x,&y);

		ans+=(y-x+1);

	}

	printf("%d",ans);

	return 0;

}

// Faster C++ solution for the same problem (measured speedup: 5.186433997068731x):
#include <cstdio>

#include <cstring>

#include <algorithm>

#include <cmath>

using namespace std;



int l, r, ans, n;

int main() {

	scanf("%d", &n);

	for(int i = 1; i <= n; ++i) {

		scanf("%d%d", &l, &r);

		ans += r - l + 1;

	}

	printf("%d", ans);

	return 0;

}
// Slower C++ solution:
#include<bits/stdc++.h>

using namespace std;

int main(){

    int n,l,r,s=0;

    cin>>n;

    while(n--){

    cin>>l>>r;

    s+=r-l+1;

    }

    cout<<s<<endl;

    return 0;

}

// Faster C++ solution for the same problem (measured speedup: 5.252463538147435x):
#include <cstdio>

#include <cstring>

#include <algorithm>

#include <cmath>

using namespace std;



int l, r, ans, n;

int main() {

	scanf("%d", &n);

	for(int i = 1; i <= n; ++i) {

		scanf("%d%d", &l, &r);

		ans += r - l + 1;

	}

	printf("%d", ans);

	return 0;

}
// Slower C++ solution:
#include<bits/stdc++.h>

using namespace std;

int a,b,c;

int z;

int main()

{

	cin>>a;

	for (int i=1;i<=a;i++)

	{

		cin>>b>>c;

		z=z+(c-b+1);

	}

	cout<<z<<endl;

	return 0;

}

// Faster C++ solution for the same problem (measured speedup: 5.25361589925795x):
#include<stdio.h>

int n,r,l,lhy,i;//lhy，最新防伪标识!（不是刘浩宇！！！）

int main()

{

    scanf("%d",&n);

    for(i=1;i<=n;i++)

    {scanf("%d%d",&l,&r);//l代表左边，r代表右边

    lhy+=r-l+1;}//加一个，头尾都有

    printf("%d\n",lhy);//回车别忘了

    return 0;

}
// Slower C++ solution:
#include<bits/stdc++.h>

using namespace std;

inline int read()

{

    int num = 0;

    char c;

    bool flag = false;

    while ((c = getchar()) == ' ' || c == '\n' || c == '\r');

        if (c == '-') flag = true;

    else

        num = c - '0';

    while (isdigit(c = getchar()))

    num = num * 10 + c - '0';

    return (flag ? -1 : 1) * num;

}

int main()

{

	int n,a,b,sum=0;

	n=read();

	for(int i=1;i<=n;i++)

	{

		a=read();

		b=read();

		sum+=b-a+1;

	}

	cout<<sum<<endl;

	return 0;

}




// Faster C++ solution for the same problem (measured speedup: 5.188992787434214x):
#include<stdio.h>

int n,r,l,lhy,i;//lhy，最新防伪标识!（不是刘浩宇！！！）

int main()

{

    scanf("%d",&n);

    for(i=1;i<=n;i++)

    {scanf("%d%d",&l,&r);//l代表左边，r代表右边

    lhy+=r-l+1;}//加一个，头尾都有

    printf("%d\n",lhy);//回车别忘了

    return 0;

}
// Slower C++ solution:
#include<bits/stdc++.h>

using namespace std;

int a,b,c,d;

int main(){

    cin>>a;

    for (int i=1;i<=a;++i){

        cin>>b>>c;

        d+=c-b+1;

    }

    cout<<d<<endl;

    return 0;

}

// Faster C++ solution for the same problem (measured speedup: 5.25361589925795x):
#include<stdio.h>

int n,r,l,lhy,i;//lhy，最新防伪标识!（不是刘浩宇！！！）

int main()

{

    scanf("%d",&n);

    for(i=1;i<=n;i++)

    {scanf("%d%d",&l,&r);//l代表左边，r代表右边

    lhy+=r-l+1;}//加一个，头尾都有

    printf("%d\n",lhy);//回车别忘了

    return 0;

}
// Slower C++ solution:
#include<bits/stdc++.h>

using namespace std;

int main(){

	int n,cnt=0,l,r;

	scanf("%d",&n);

	while(n--){

		scanf("%d%d",&l,&r);

		cnt+=r-l+1;

	}

	cout<<cnt<<endl;

	return 0;

}

// Faster C++ solution for the same problem (measured speedup: 5.207690919901246x):
#include<stdio.h>

int n,r,l,lhy,i;//lhy，最新防伪标识!（不是刘浩宇！！！）

int main()

{

    scanf("%d",&n);

    for(i=1;i<=n;i++)

    {scanf("%d%d",&l,&r);//l代表左边，r代表右边

    lhy+=r-l+1;}//加一个，头尾都有

    printf("%d\n",lhy);//回车别忘了

    return 0;

}
// Slower C++ solution:
#include<iostream>

using namespace std;

int main()

{

	int n,a[10002],b[10002],ans=0;

	cin>>n;

	for(int i=1;i<=n;i++)

	{

		cin>>a[i]>>b[i];

	}

	for(int i=1;i<=n;i++)

	{

		ans+=b[i]-a[i]+1;

	}

	cout<<ans;

	return 0;

}

// Faster C++ solution for the same problem (measured speedup: 5.245842812346976x):
#include<stdio.h>

int n,r,l,lhy,i;//lhy，最新防伪标识!（不是刘浩宇！！！）

int main()

{

    scanf("%d",&n);

    for(i=1;i<=n;i++)

    {scanf("%d%d",&l,&r);//l代表左边，r代表右边

    lhy+=r-l+1;}//加一个，头尾都有

    printf("%d\n",lhy);//回车别忘了

    return 0;

}
// Slower C++ solution:
#include<bits/stdc++.h>

using namespace std;

int n,l,r,ans;

int main(){

    cin>>n;

    for(int i=1;i<=n;i++){

        cin>>l>>r;

        ans+=r-l+1;

    }

    cout<<ans<<endl;

}

// Faster C++ solution for the same problem (measured speedup: 5.253674801719393x):
#include<stdio.h>

int n,r,l,lhy,i;//lhy，最新防伪标识!（不是刘浩宇！！！）

int main()

{

    scanf("%d",&n);

    for(i=1;i<=n;i++)

    {scanf("%d%d",&l,&r);//l代表左边，r代表右边

    lhy+=r-l+1;}//加一个，头尾都有

    printf("%d\n",lhy);//回车别忘了

    return 0;

}
// Slower C++ solution:
#include<bits/stdc++.h>

using namespace std;

int n,l,r,ans,i;

int main(){

	scanf("%d",&n);

	for(i=1;i<=n;i++){

		scanf("%d%d",&l,&r);

		ans+=r-l+1;

	}

	printf("%d",ans);

	return 0;

}

// Faster C++ solution for the same problem (measured speedup: 5.185193414776069x):
#include<stdio.h>

int n,r,l,lhy,i;//lhy，最新防伪标识!（不是刘浩宇！！！）

int main()

{

    scanf("%d",&n);

    for(i=1;i<=n;i++)

    {scanf("%d%d",&l,&r);//l代表左边，r代表右边

    lhy+=r-l+1;}//加一个，头尾都有

    printf("%d\n",lhy);//回车别忘了

    return 0;

}
// Slower C++ solution:
#include<bits/stdc++.h>

using namespace std;

int main(){

    int n;

    int l,r,ans=0;

    cin>>n;

    for(int i=1;i<=n;i++){

        cin>>l>>r;

        ans+=r-l+1;

    }

    cout<<ans<<endl;

}

// Faster C++ solution for the same problem (measured speedup: 5.252031646797525x):
#include<stdio.h>

int n,r,l,lhy,i;//lhy，最新防伪标识!（不是刘浩宇！！！）

int main()

{

    scanf("%d",&n);

    for(i=1;i<=n;i++)

    {scanf("%d%d",&l,&r);//l代表左边，r代表右边

    lhy+=r-l+1;}//加一个，头尾都有

    printf("%d\n",lhy);//回车别忘了

    return 0;

}
// Slower C++ solution:
#include<bits/stdc++.h>

using namespace std;

int main()

{

	int l,r;

	int n;

	cin>>n;

	int ans=0;

	for(int i=1;i<=n;i++)

	{

		cin>>l>>r;

		ans+=r-l+1;

	}

	cout<<ans<<endl;

}

// Faster C++ solution for the same problem (measured speedup: 5.252031646797525x):
#include<stdio.h>

int n,r,l,lhy,i;//lhy，最新防伪标识!（不是刘浩宇！！！）

int main()

{

    scanf("%d",&n);

    for(i=1;i<=n;i++)

    {scanf("%d%d",&l,&r);//l代表左边，r代表右边

    lhy+=r-l+1;}//加一个，头尾都有

    printf("%d\n",lhy);//回车别忘了

    return 0;

}