#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp> 
#include <ext/pb_ds/tree_policy.hpp> 
#include <functional> // for less 
using namespace __gnu_pbds; 
using namespace std;
#define int long long
#define endl "\n"
#define deb(x) cout<<#x<<" "<<x<<endl;
#define sc(ar,n) for(int pen=0;pen<n;pen++){ cin>>ar[pen];}
#define pr(ar,n) for(int pen=0;pen<n;pen++){ cout<<ar[pen]<<" ";} cout<<endl;
#define fr(i,x,n) for(int i=x;i<n;i++)
#define frt(it,vb) for(auto it=vb.begin();it!=vb.end();it++)
#define mem(ar,x) memset(ar,x,sizeof(ar));
#define pb push_back
#define fastio ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define mod 1000000007
#define rt return 0;
#define ct continue;
#define MAX 1000000000000000000
#define MAX1 1000000000
#define CLK clock_t clk = clock();//Start of main
#define OCLK cerr << "Time (in ms): " << (double)(clock() - clk) * 1000.0 / CLOCKS_PER_SEC << '\n';//End of main
#define ordered_set tree<int, null_type,less<int>, rb_tree_tag,tree_order_statistics_node_update> 

inline int solve()
{
    int l,r;
    cin>>l>>r;
    int x = r-2*l;
    if(x<0){
        cout<<0<<endl;
        rt;
    }
    int ans = (r+1)*(x+1) - 2*l*(x+1) - (x*(x+1))/2;
    cout << ans << endl;
  rt;
}
signed main()
{
    // fastio;
    int t;
    int test_cases=0;
    if(test_cases==0)
    cin>>t;
    else
    t=1;
    while(t--){
        solve();
    }
}
#include <bits/stdc++.h> // include every standard library
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
using namespace std;     
  
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<vi> vvi;
typedef vector<vl> vvl;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef long double ld;
typedef vector<bool> vb;
typedef vector<vb> vvb;
typedef vector<pll> vpll;
typedef vector<pii> vpii;

#define oset tree<int, null_type,less_equal<int>, rb_tree_tag,tree_order_statistics_node_update>
#define in() freopen("test.txt","r",stdin)
#define out() freopen("output.txt","w",stdout)
#define vt vector
#define pb push_back
#define eb emplace_back
#define pob pop_back
#define mk make_pair
#define fi first
#define se second
#define nl "\n"
#define MOD 1000000007
#define all(v) v.begin(),v.end()
#define s(v) v.size()
#define test ll t;cin>>t;while(t--)
#define read0(v,n) for(int i=0;i<n;i++)cin>>v[i];
#define read1(v,n) for(int i=1;i<=n;i++)cin>>v[i];
#define trav(a,x) for (auto& a: x)
#define fast ios_base::sync_with_stdio(false);cin.tie(NULL);
#define cut(x) {cout<<x;return 0;}
#define print(x) {cout<<x<<nl;}
#define FOR(i,a,b) for(int i=a;i<b;++i)
#define FORB(i,a,b) for(int i=a;i>=b;--i)
#define err1(a) {cout<<#a<<' '<<a<<nl;}
#define err2(a,b) {cout<<#a<<' '<<a<<' '<<#b<<' '<<b<<nl;}
#define mem(a,b) memset(a,b,sizeof(a))
#define maxn 100000
#define dis(ar,n) {for(int i=0;i<(n);++i) cout << ar[i] << " "; cout << nl;}
ll gcd(ll a, ll b){if (b==0)return a;return gcd(b, a % b);}
ll lcm(ll a,ll b){return (a*b)/gcd(a,b);}
ll bpow(ll a, ll b){ll ans=1;while(b){if(b&1)ans=(ans*a)%MOD;b/=2;a=(a*a)%MOD;}return ans;}
vt<pair<int,int>> dir = {{1,0},{-1,0},{0,1},{0,-1}};
int main(){
 	fast
	unordered_set<int> s;
	int n;cin >> n;
	for(int i=0;i<n;++i)
	{
	  int a;
	  cin >> a;
	  s.insert(a);
	}
	for(int i=1;i<=n;++i){
	  if(s.find(i) == s.end())
		  cut("No")
	}
	cut("Yes")
	return 0;
}
