#include <cstdio>
#include <cmath>
#include <iostream>
#include <set>
#include <algorithm>
#include <vector>
#include <map>
#include <cassert>
#include <string>
#include <cstring>
#include <queue>

using namespace std;

#define rep(i,a,b) for(int i = a; i < b; i++)
#define S(x) scanf("%d",&x)
#define S2(x,y) scanf("%d%d",&x,&y)
#define P(x) printf("%d\n",x)
#define all(v) v.begin(),v.end()
#define mp make_pair
#define pb push_back
#define FF first
#define SS second

typedef long long int LL;
typedef pair<int, int > pii;
typedef vector<int > vi;

const int N = 10000001;

LL dp[10000][30];

bool good(int x, int y, int z) {
  LL res = 1;
  while(y--) {
    res *= x;
    if(res > z) return false;
  }
  return true;
}

int getFulls(int x, int n) {
  int lo = 2, hi = 10000;
  int res = 0;
  while(lo <= hi) {
    int mi = (lo + hi) >> 1;
    if(good(mi, n, x)) {
      res = mi - 1;
      lo = mi + 1;
    } else {
      hi = mi - 1;
    }
  }
  return res;
}

LL pw(int x, int y) {
  LL &res = dp[x][y];
  if(res) return res;
  res = 1;
  while(y--) {
    res *= x;
    if(res >= N) {
      return res = -1;
    }
  }
  return res;
}

int main() {
  int n,l,r;
  scanf("%d%d%d",&n,&l,&r);
  if(n > 25) {
    P(0);
    return 0;
  }

  if(n == 1) {
    P(r-l+1);
    return 0;
  }

  if(n == 2) {
    LL x = r - l + 1;
    cout << x * (x - 1) << "\n";
    return 0;
  }

  LL ans = 0;
  rep(i,l,r+1) {
    // full Nums
    ans += getFulls(r / i, n - 1);
  }

  rep(i,2,N) {
    LL x = pw(i, n - 1);
    if(x == -1) break;
    for(int j = x; j < N; j += x) if(j >= l && j <= r) {
      int tmp = j / x;
      for(int k = i - 1; k > 0; k--) if(__gcd(k,i) == 1) {
        LL y = pw(k, n - 1);
        if(tmp * y >= l) ans++;
        else break;
      }

      for(int k = i + 1; k < 1000000000; k++) if(__gcd(k,i) == 1) {
        LL y = pw(k, n - 1);
        if(y == -1) break;
        if(tmp <= r / y) ans++;
        else break;
      }

    }
  }

  cout << ans << "\n";
  return 0;
}


#include <cstdio>
#include <cmath>
#include <iostream>
#include <set>
#include <algorithm>
#include <vector>
#include <map>
#include <cassert>
#include <string>
#include <cstring>
#include <queue>

using namespace std;

#define rep(i,a,b) for(int i = a; i < b; i++)
#define S(x) scanf("%d",&x)
#define S2(x,y) scanf("%d%d",&x,&y)
#define P(x) printf("%d\n",x)
#define all(v) v.begin(),v.end()
#define mp make_pair
#define pb push_back
#define FF first
#define SS second

typedef long long int LL;
typedef pair<int, int > pii;
typedef vector<int > vi;

const int N = 10000001;

LL dp[10000][30];

bool good(int x, int y, int z) {
  LL res = 1;
  while(y--) {
    res *= x;
    if(res > z) return false;
  }
  return true;
}

int getFulls(int x, int n) {
  int lo = 2, hi = 250;
  int res = 0;
  while(lo <= hi) {
    int mi = (lo + hi) >> 1;
    if(good(mi, n, x)) {
      res = mi - 1;
      lo = mi + 1;
    } else {
      hi = mi - 1;
    }
  }
  return res;
}

LL pw(int x, int y) {
  LL &res = dp[x][y];
  if(res) return res;
  res = 1;
  while(y--) {
    res *= x;
    if(res >= N) {
      return res = -1;
    }
  }
  return res;
}

int main() {
  int n,l,r;
  scanf("%d%d%d",&n,&l,&r);
  if(n > 25) {
    P(0);
    return 0;
  }

  if(n == 1) {
    P(r-l+1);
    return 0;
  }

  if(n == 2) {
    LL x = r - l + 1;
    cout << x * (x - 1) << "\n";
    return 0;
  }

  LL ans = 0;
  rep(i,l,r+1) {
    // full Nums
    ans += getFulls(r / i, n - 1);
  }

  rep(i,2,N) {
    LL x = pw(i, n - 1);
    if(x == -1) break;
    for(int j = x; j < N; j += x) if(j >= l && j <= r) {
      int tmp = j / x;
      for(int k = i - 1; k > 0; k--) if(__gcd(k,i) == 1) {
        LL y = pw(k, n - 1);
        if(tmp * y >= l) ans++;
        else break;
      }

      for(int k = i + 1; k < 1000000000; k++) if(__gcd(k,i) == 1) {
        LL y = pw(k, n - 1);
        if(y == -1) break;
        if(tmp <= r / y) ans++;
        else break;
      }

    }
  }

  cout << ans << "\n";
  return 0;
}


#include <cstdio>
#include <cmath>
#include <iostream>
#include <set>
#include <algorithm>
#include <vector>
#include <map>
#include <cassert>
#include <string>
#include <cstring>
#include <queue>

using namespace std;

#define rep(i,a,b) for(int i = a; i < b; i++)
#define S(x) scanf("%d",&x)
#define S2(x,y) scanf("%d%d",&x,&y)
#define P(x) printf("%d\n",x)
#define all(v) v.begin(),v.end()
#define mp make_pair
#define pb push_back
#define FF first
#define SS second

typedef long long int LL;
typedef pair<int, int > pii;
typedef vector<int > vi;

const int N = 10000001;

bool good(int x, int y, int z) {
  LL res = 1;
  while(y--) {
    res *= x;
    if(res > z) return false;
  }
  return true;
}

int getFulls(int x, int n) {
  int lo = 2, hi = 250;
  int res = 0;
  while(lo <= hi) {
    int mi = (lo + hi) >> 1;
    if(good(mi, n, x)) {
      res = mi - 1;
      lo = mi + 1;
    } else {
      hi = mi - 1;
    }
  }
  return res;
}

LL pw(int x, int y) {
  LL res = 1;
  while(y--) {
    res *= x;
    if(res >= N) return -1;
  }
  return res;
}

int main() {
  int n,l,r;
  scanf("%d%d%d",&n,&l,&r);
  if(n > 25) {
    P(0);
    return 0;
  }

  if(n == 1) {
    P(r-l+1);
    return 0;
  }

  if(n == 2) {
    LL x = r - l + 1;
    cout << x * (x - 1) << "\n";
    return 0;
  }

  LL ans = 0;
  rep(i,l,r+1) {
    // full Nums
    ans += getFulls(r / i, n - 1);
  }

  rep(i,2,N) {
    LL x = pw(i, n - 1);
    if(x == -1) break;
    for(int j = x; j < N; j += x) if(j >= l && j <= r) {
      int tmp = j / x;
      for(int k = i - 1; k > 0; k--) if(__gcd(k,i) == 1) {
        LL y = pw(k, n - 1);
        if(tmp * y >= l) ans++;
        else break;
      }

      for(int k = i + 1; k < 1000000000; k++) if(__gcd(k,i) == 1) {
        LL y = pw(k, n - 1);
        if(y == -1) break;
        if(tmp <= r / y) ans++;
        else break;
      }

    }
  }

  cout << ans << "\n";
  return 0;
}


#include <iostream>
#include <cstdio>
#include <string>
#include <cassert>
#include <cstdlib>
#include <vector>
#include <algorithm>
#include <set>
#include <map>
#include <bitset>
#include <ctime>
#include <cstdlib>
#include <fstream>
#include <iomanip>
#include <sstream>
#include <numeric>
#include <unordered_map>
#include <unordered_set>

using namespace std;

#define sz(a) (int)(a.size())
#define int long long

int pow2(int a, int b)
{
	if (b == 0)
		return 1;
	if (b & 1)
		return pow2(a, b ^ 1) * a;
	else
	{
		int t = pow2(a, b >> 1);
		return t * t;
	}
}

int gcd(int a, int b)
{
	while (b)
	{
		a %= b;
		swap(a, b);
	}
	return a;
}

signed main()
{
#ifndef ONLINE_JUDGE
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
#endif
	ios_base::sync_with_stdio(0);
	int n, l, r;
	cin >> n >> l >> r;
	if (n == 1)
		cout << (r - l + 1);
	else if (n == 2)
		cout << (r - l + 1) * (r - l);
	else
	{
		int ans = 0;
		for (int i = 1; i <= r; ++i)
		{
			int t = pow2(i, n - 1);
			if (t > r)
				break;
			for (int j = 1; j < i; ++j)
			{
				if (gcd(i, j) != 1)
					continue;
				int g = pow2(j, n - 1);
				for (int k = g; k <= r; k += g)
				{
					if (k / g * t <= r)
						++ans;
				}
			}
		}
		cout << ans * 2;
	}
	return 0;
}


#include <iostream>
#include <cstdio>
#include <string>
#include <cassert>
#include <cstdlib>
#include <vector>
#include <algorithm>
#include <set>
#include <map>
#include <bitset>
#include <ctime>
#include <cstdlib>
#include <fstream>
#include <iomanip>
#include <sstream>
#include <numeric>
#include <unordered_map>
#include <unordered_set>

using namespace std;

#define sz(a) (int)(a.size())
#define int long long

int pow2(int a, int b)
{
	if (b == 0)
		return 1;
	if (b & 1)
		return pow2(a, b ^ 1) * a;
	else
	{
		int t = pow2(a, b >> 1);
		return t * t;
	}
}

int gcd(int a, int b)
{
	while (b)
	{
		a %= b;
		swap(a, b);
	}
	return a;
}

signed main()
{
#ifndef ONLINE_JUDGE
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
#endif
	ios_base::sync_with_stdio(0);
	int n, l, r;
	cin >> n >> l >> r;
	if (n == 1)
		cout << (r - l + 1);
	else if (n == 2)
		cout << (r - l + 1) * (r - l);
	else
	{
		int ans = 0;
		for (int i = 1; i <= r; ++i)
		{
			int t = pow2(i, n - 1);
			if (t > r)
				break;
			for (int j = 1; j < i; ++j)
			{
				if (gcd(i, j) != 1)
					continue;
				int g = pow2(j, n - 1);
				for (int k = g; k <= r; k += g)
				{
					if (k < l)
						continue;
					if (k / g * t <= r)
						++ans;
				}
			}
		}
		cout << ans * 2;
	}
	return 0;
}


#include <iostream>
#include <cstdio>
#include <string>
#include <cassert>
#include <cstdlib>
#include <vector>
#include <algorithm>
#include <set>
#include <map>
#include <bitset>
#include <ctime>
#include <cstdlib>
#include <fstream>
#include <iomanip>
#include <sstream>
#include <numeric>
#include <unordered_map>
#include <unordered_set>

using namespace std;

#define sz(a) (int)(a.size())
#define int long long

int pow2(int a, int b)
{
	if (b == 0)
		return 1;
	if (b & 1)
		return pow2(a, b ^ 1) * a;
	else
	{
		int t = pow2(a, b >> 1);
		return t * t;
	}
}

int gcd(int a, int b)
{
	while (b)
	{
		a %= b;
		swap(a, b);
	}
	return a;
}

signed main()
{
#ifndef ONLINE_JUDGE
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
#endif
	ios_base::sync_with_stdio(0);
	int n, l, r;
	cin >> n >> l >> r;
	if (n == 1)
		cout << (r - l + 1);
	else if (n == 2)
		cout << (r - l + 1) * (r - l);
	else
	{
		int ans = 0;
		for (int i = 1; i <= r; ++i)
		{
			int t = pow2(i, n - 1);
			if (t > r)
				break;
			for (int k = t; k <= r; k += t)
			{
				if (k < l)
					continue;
				for (int j = 1; j < i; ++j)
				{
					if (gcd(i, j) != 1)
						continue;
					int g = pow2(j, n - 1);
					if (g > r)
						break;
					if (k / t * g <= r)
						++ans;
			}
		}
		cout << ans * 2;
	}
	return 0;
}


#include <iostream>
#include <cstdio>
#include <string>
#include <cassert>
#include <cstdlib>
#include <vector>
#include <algorithm>
#include <set>
#include <map>
#include <bitset>
#include <ctime>
#include <cstdlib>
#include <fstream>
#include <iomanip>
#include <sstream>
#include <numeric>
#include <unordered_map>
#include <unordered_set>

using namespace std;

#define sz(a) (int)(a.size())
#define int long long

int pow2(int a, int b)
{
	if (b == 0)
		return 1;
	if (b & 1)
		return pow2(a, b ^ 1) * a;
	else
	{
		int t = pow2(a, b >> 1);
		return t * t;
	}
}

int gcd(int a, int b)
{
	while (b)
	{
		a %= b;
		swap(a, b);
	}
	return a;
}

signed main()
{
#ifndef ONLINE_JUDGE
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
#endif
	ios_base::sync_with_stdio(0);
	int n, l, r;
	cin >> n >> l >> r;
	if (n == 1)
		cout << (r - l + 1);
	else if (n == 2)
		cout << (r - l + 1) * (r - l);
	else
	{
		int ans = 0;
		for (int i = 1; i <= r; ++i)
		{
			int t = pow2(i, n - 1);
			if (t > r)
				break;
			for (int k = t; k <= r; k += t)
			{
				if (k < l)
					continue;
				for (int j = 1; j < i; ++j)
				{
					if (gcd(i, j) != 1)
						continue;
					int g = pow2(j, n - 1);
					if (g > r)
						break;
					if (k / t * g <= r)
						++ans;
				}
			}
		}
		cout << ans * 2;
	}
	return 0;
}


#include <iostream>
#include <cstdio>
#include <string>
#include <cassert>
#include <cstdlib>
#include <vector>
#include <algorithm>
#include <set>
#include <map>
#include <bitset>
#include <ctime>
#include <cstdlib>
#include <fstream>
#include <iomanip>
#include <sstream>
#include <numeric>
#include <unordered_map>
#include <unordered_set>

using namespace std;

#define sz(a) (int)(a.size())
#define int long long

int pow2(int a, int b)
{
	if (b == 0)
		return 1;
	if (b & 1)
		return pow2(a, b ^ 1) * a;
	else
	{
		int t = pow2(a, b >> 1);
		return t * t;
	}
}

int gcd(int a, int b)
{
	while (b)
	{
		a %= b;
		swap(a, b);
	}
	return a;
}

signed main()
{
#ifndef ONLINE_JUDGE
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
#endif
	ios_base::sync_with_stdio(0);
	int n, l, r;
	cin >> n >> l >> r;
	if (n == 1)
		cout << (r - l + 1);
	else if (n == 2)
		cout << (r - l + 1) * (r - l);
	else
	{
		int ans = 0;
		for (int i = 1; i <= r; ++i)
		{
			int t = pow2(i, n - 1);
			if (t > r)
				break;
			for (int j = 1; j < i; ++j)
			{
				if (gcd(i, j) != 1)
					continue;
				int g = pow2(j, n - 1);
				if (g > r)
					break;
				for (int k = g; k <= r; k += g)
				{
					if (k < l)
						continue;
					if (k / g * t <= r)
						++ans;
				}
			}
		}
		cout << ans * 2;
	}
	return 0;
}


#include <iostream>
#include <cstdio>
#include <string>
#include <cassert>
#include <cstdlib>
#include <vector>
#include <algorithm>
#include <set>
#include <map>
#include <bitset>
#include <ctime>
#include <cstdlib>
#include <fstream>
#include <iomanip>
#include <sstream>
#include <numeric>
#include <unordered_map>
#include <unordered_set>

using namespace std;

#define sz(a) (int)(a.size())
#define int long long

int pow2(int a, int b)
{
	if (b == 0)
		return 1;
	if (b & 1)
		return pow2(a, b ^ 1) * a;
	else
	{
		int t = pow2(a, b >> 1);
		return t * t;
	}
}

int gcd(int a, int b)
{
	while (b)
	{
		a %= b;
		swap(a, b);
	}
	return a;
}

signed main()
{
#ifndef ONLINE_JUDGE
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
#endif
	ios_base::sync_with_stdio(0);
	int n, l, r;
	cin >> n >> l >> r;
	if (n == 1)
		cout << (r - l + 1);
	else if (n == 2)
		cout << (r - l + 1) * (r - l);
	else
	{
		int ans = 0;
		for (int i = 1; i <= r; ++i)
		{
			int t = pow2(i, n - 1);
			if (t > r)
				break;
			for (int k = t; k <= r; k += t)
			{
				if (k < l)
					continue;
				for (int j = 1; j < i; ++j)
				{
					if (gcd(i, j) != 1)
						continue;
					int g = pow2(j, n - 1);
					if (g > r)
						break;
					if (l <= k / t * g && k / t * g <= r)
						++ans;
				}
			}
		}
		cout << ans * 2;
	}
	return 0;
}


#include <iostream>
#include <cstdio>
#include <string>
#include <cassert>
#include <cstdlib>
#include <vector>
#include <algorithm>
#include <set>
#include <map>
#include <bitset>
#include <ctime>
#include <cstdlib>
#include <fstream>
#include <iomanip>
#include <sstream>
#include <numeric>
#include <unordered_map>
#include <unordered_set>

using namespace std;

#define sz(a) (int)(a.size())
#define int long long

int pow2(int a, int b)
{
	if (b == 0)
		return 1;
	if (b & 1)
		return pow2(a, b ^ 1) * a;
	else
	{
		int t = pow2(a, b >> 1);
		return t * t;
	}
}

int gcd(int a, int b)
{
	while (b)
	{
		a %= b;
		swap(a, b);
	}
	return a;
}

signed main()
{
#ifndef ONLINE_JUDGE
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
#endif
	ios_base::sync_with_stdio(0);
	int n, l, r;
	cin >> n >> l >> r;
	if (n == 1)
		cout << (r - l + 1);
	else if (n == 2)
		cout << (r - l + 1) * (r - l);
	else if (n > 228)
		cout << 0;
	else
	{
		int ans = 0;
		for (int i = 1; i <= r; ++i)
		{
			int t = pow2(i, n - 1);
			if (t > r)
				break;
			for (int k = t; k <= r; k += t)
			{
				if (k < l)
					continue;
				for (int j = 1; j < i; ++j)
				{
					if (gcd(i, j) != 1)
						continue;
					int g = pow2(j, n - 1);
					if (g > r)
						break;
					if (l <= k / t * g && k / t * g <= r)
						++ans;
				}
			}
		}
		cout << ans * 2;
	}
	return 0;
}


#include <iostream>
#include <cstdio>
#include <string>
#include <cassert>
#include <cstdlib>
#include <vector>
#include <algorithm>
#include <set>
#include <map>
#include <bitset>
#include <ctime>
#include <cstdlib>
#include <fstream>
#include <iomanip>
#include <sstream>
#include <numeric>
#include <unordered_map>
#include <unordered_set>

using namespace std;

#define sz(a) (int)(a.size())
#define int long long

int pow2(int a, int b)
{
	if (b == 0)
		return 1;
	if (b & 1)
		return pow2(a, b ^ 1) * a;
	else
	{
		int t = pow2(a, b >> 1);
		return t * t;
	}
}

int gcd(int a, int b)
{
	while (b)
	{
		a %= b;
		swap(a, b);
	}
	return a;
}

signed main()
{
#ifndef ONLINE_JUDGE
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
#endif
	ios_base::sync_with_stdio(0);
	int n, l, r;
	cin >> n >> l >> r;
	if (n == 1)
		cout << (r - l + 1);
	else if (n == 2)
		cout << (r - l + 1) * (r - l);
	else
	{
		int ans = 0;
		for (int i = 1; i <= r; ++i)
		{
			int t = pow2(i, n - 1);
			if (t > r)
				break;
			for (int j = 1; j < i; ++j)
			{
				if (gcd(i, j) != 1)
					continue;
				int g = pow2(j, n - 1);
				if (g < l)
					continue;
				for (int k = g; k <= r; k += g)
				{
					if (k / g * t <= r)
						++ans;
				}
			}
		}
		cout << ans * 2;
	}
	return 0;
}


#include <bits/stdc++.h>

using namespace std;

typedef long long LL;
LL n, l, r;
LL ans = 0;

LL Pow(LL a, LL b) {
    LL res = 1;
    while(b) {
        if(b & 1) res = res * a;
        b >>= 1;
        a = a * a;
    }
    return res;
}

int main() {
    scanf("%I64d%I64d%I64d", &n, &l, &r);
    if(n == 1)
        cout<<r-l+1<<endl;
    else if(n == 2)
        cout<<(r-l+1)*(r-l)<<endl;
    else if(n >= 60)
        cout<<0<<endl;
    else {
        for(LL q = 1; ; q++) {
            LL x = Pow(q, n - 1);
            if(x > r) break;
            for(LL p = q + 1; ; p++) {
                LL y = Pow(p, n - 1);
                if(y > r) break;
                if(__gcd(p, q) != 1) continue;
                ans += max(0LL, r/y - (l+x-1)/x + 1);
            }
        }
        cout<<ans*2<<endl;
    }
    return 0;
}


#include <bits/stdc++.h>

using namespace std;
/*
首先，对于n = 1以及n = 2可以很简单特判
然后考虑等比数列
假设 k = p / q, gcd(p, q) = 1.
a1 * (k)^(n-1) = an;
则a1 * p^(n-1) / q^(n-1) = an;
所以 q^(n-1) | a1， 则令 b = a1 / q^(n-1)， a1 = b * q^(n-1), an = b * p^(n-1).
那么在同一个pq下的数列可由一个b唯一确立。
b不同，数列则不同，等价于求不同的b的数目。
l <= a1 <= an <= r  => l/q^(n-1) <= b <= r/p^(n-1)，对每个枚举pq，对每对pq求b即可。
需要注意对左边的向上取整转化为左右闭区间。
然后考虑到n过大时，快速幂会爆LL，并且毫无意义，直接判0。
*/
typedef long long LL;
LL n, l, r;
LL ans = 0;

LL Pow(LL a, LL b) {
    LL res = 1;
    while(b) {
        if(b & 1) res = res * a;
        b >>= 1;
        a = a * a;
    }
    return res;
}

int main() {
    scanf("%I64d%I64d%I64d", &n, &l, &r);
    if(n == 1)
        cout<<r-l+1<<endl;
    else if(n == 2)
        cout<<(r-l+1)*(r-l)<<endl;
    else if(n >= 60)
        cout<<0<<endl;
    else {
        for(LL q = 1; ; q++) {
            LL x = Pow(q, n - 1);
            if(x > r) break;
            for(LL p = q + 1; ; p++) {
                LL y = Pow(p, n - 1);
                if(y > r) break;
                if(__gcd(p, q) != 1) continue;
                ans += max(0LL, r/y - (l+x-1)/x + 1);
            }
        }
        cout<<ans*2<<endl;
    }
    return 0;
}


#include <bits/stdc++.h>

using namespace std;
/*
首先，对于n = 1以及n = 2可以很简单特判
然后考虑等比数列
假设 k = p / q, gcd(p, q) = 1.
a1 * (k)^(n-1) = an;
则a1 * p^(n-1) / q^(n-1) = an;
所以 q^(n-1) | a1， 则令 b = a1 / q^(n-1)， a1 = b * q^(n-1), an = b * p^(n-1).
那么在同一个pq下的数列可由一个b唯一确立。
b不同，数列则不同，等价于求不同的b的数目。
l <= a1 <= an <= r  => l/q^(n-1) <= b <= r/p^(n-1)，对每个枚举pq，对每对pq求b即可。
需要注意对左边的向上取整转化为左右闭区间。
然后考虑到n过大时，快速幂会爆LL，并且毫无意义，直接判0。
*/
typedef long long LL;
LL n, l, r;
LL ans = 0;

LL Pow(LL a, LL b) {
    LL res = 1;
    while(b) {
        if(b & 1) res = res * a;
        b >>= 1;
        a = a * a;
    }
    return res;
}

int main() {
    scanf("%I64d%I64d%I64d", &n, &l, &r);
    if(n == 1)
        cout<<r-l+1<<endl;
    else if(n == 2)
        cout<<(r-l+1)*(r-l)<<endl;
    else if(n >= 30)
        cout<<0<<endl;
    else {
        for(LL q = 1; ; q++) {
            LL x = Pow(q, n - 1);
            if(x > r) break;
            for(LL p = q + 1; ; p++) {
                LL y = Pow(p, n - 1);
                if(y > r) break;
                if(__gcd(p, q) != 1) continue;
                ans += max(0LL, r/y - (l+x-1)/x + 1);
            }
        }
        cout<<ans*2<<endl;
    }
    return 0;
}


#include <bits/stdc++.h>

using namespace std;

typedef long long LL;
LL n, l, r;
LL ans = 0;

LL Pow(LL a, LL b) {
    LL res = 1;
    while(b) {
        if(b & 1) res = res * a;
        b >>= 1;
        a = a * a;
    }
    return res;
}

int main() {
    scanf("%I64d%I64d%I64d", &n, &l, &r);
    if(n == 1)
        cout<<r-l+1<<endl;
    else if(n == 2)
        cout<<(r-l+1)*(r-l)<<endl;
    else {
        for(LL q = 1; ; q++) {
            LL x = Pow(q, n - 1);
            if(x > r) break;
            for(LL p = q + 1; ; p++) {
                LL y = Pow(p, n - 1);
                if(y > r) break;
                if(__gcd(p, q) != 1) continue;
                ans += max(0LL, r/y - (l+x-1)/x + 1);
            }
        }
        cout<<ans*2<<endl;
    }
    return 0;
}


import java.io.BufferedReader;
import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap;
import java.util.HashSet;
import java.util.StringTokenizer;

import javax.xml.crypto.dsig.spec.XSLTTransformParameterSpec;

public class Main
{

	public static void main(String[] args) throws IOException
	{
		Main main = new Main();
		main.read();
	}

	/* IO */
	private InputReader in;
	private StringBuilder ans;

	/* fields */
	private int n;
	private int[] arr;

	private void read() throws IOException
	{
		// streams
		boolean file = false;
		if (file)
			in = new InputReader(new FileInputStream("Input.txt"));
		else
			in = new InputReader(System.in);
		ans = new StringBuilder();

		// read
		n = Integer.parseInt(in.next());
		arr = new int[n];
		for (int i = 0; i < n; i++)
			arr[i] = Integer.parseInt(in.next());

		// solve
		solve();
		System.out.print(ans.toString());
	}

	private void solve()
	{
		// to get sorted back
		HashMap<Integer, Integer> toIndex = new HashMap<>();
		for (int i = 0; i < n; i++)
			toIndex.put(arr[i], i);
		Arrays.sort(arr);

		// first third
		int a[] = new int[n];
		int b[] = new int[n];
		int count1 = n / 3;
		if (3 * count1 < n)
			count1++;
		int idx = 0;
		int curr = 0;
		for (int i = 0; i < count1; i++)
		{
			a[idx] = curr++;
			b[idx] = arr[idx] - a[idx];
			idx++;
		}
		int lastA = curr - 1;

		// second third
		int count2 = n / 3;
		if (n / 3 + count1 + count2 < n)
			count2++;
		for (int i = 0; i < count2; i++)
		{
			b[idx] = curr++;
			a[idx] = arr[idx] - b[idx];
			idx++;
		}

		// last third
		for (int i = idx; i < n; i++)
		{
			b[i] = lastA--;
			if (b[i] < 0)
				b[i] = 0;
			a[i] = arr[i] - b[i];
		}

		// restor order
		int aNew[] = new int[n];
		int bNew[] = new int[n];
		for (int i = 0; i < n; i++)
		{
			int sum = a[i] + b[i];
			int originalIndex = toIndex.get(sum);
			aNew[originalIndex] = a[i];
			bNew[originalIndex] = b[i];
		}

		// form answer
		ans.append("YES\n");
		ans.append(toString(aNew) + "\n");
		ans.append(toString(bNew) + "\n");

	}

	private String toString(int[] a)
	{
		StringBuilder strb = new StringBuilder();
		for (int x : a)
			strb.append(x + " ");
		return strb.toString().trim();
	}

}

class Item
{
	int value;
	int idx;
}

class InputReader
{
	public BufferedReader reader;
	public StringTokenizer tokenizer;

	public InputReader(InputStream stream)
	{
		reader = new BufferedReader(new InputStreamReader(stream), 32768);
		tokenizer = null;
	}

	public String next()
	{
		while (tokenizer == null || !tokenizer.hasMoreTokens())
		{
			try
			{
				tokenizer = new StringTokenizer(reader.readLine());
			} catch (IOException e)
			{
				throw new RuntimeException(e);
			}
		}
		return tokenizer.nextToken();
	}

}


import java.io.BufferedReader;
import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap;
import java.util.HashSet;
import java.util.StringTokenizer;

import javax.xml.crypto.dsig.spec.XSLTTransformParameterSpec;

public class Main
{

	public static void main(String[] args) throws IOException
	{
		Main main = new Main();
		main.read();
	}

	/* IO */
	private InputReader in;
	private StringBuilder ans;

	/* fields */
	private int n;
	private int[] arr;

	private void read() throws IOException
	{
		// streams
		boolean file = false;
		if (file)
			in = new InputReader(new FileInputStream("Input.txt"));
		else
			in = new InputReader(System.in);
		ans = new StringBuilder();

		// read
		n = Integer.parseInt(in.next());
		arr = new int[n];
		for (int i = 0; i < n; i++)
			arr[i] = Integer.parseInt(in.next());

		// solve
		solve();
		System.out.print(ans.toString());
	}

	private void solve()
	{
		// to get sorted back
		HashMap<Integer, Integer> toIndex = new HashMap<>();
		for (int i = 0; i < n; i++)
			toIndex.put(arr[i], i);

		// first third
		int a[] = new int[n];
		int b[] = new int[n];
		int count = n / 3;
		int idx = 0;
		int curr = 0;
		for (int i = 0; i < count; i++)
		{
			a[idx] = curr++;
			b[idx] = arr[idx] - a[idx];
			idx++;
		}
		int lastA = curr - 1;

		// second third
		for (int i = 0; i < count; i++)
		{
			b[idx] = curr++;
			a[idx] = arr[idx] - b[idx];
			idx++;
		}

		// last third
		for (int i = idx; i < n; i++)
		{
			b[i] = lastA--;
			if (b[i] < 0)
				b[i] = 0;
			a[i] = arr[i] - b[i];
		}

		// restor order
		int aNew[] = new int[n];
		int bNew[] = new int[n];
		for (int i = 0; i < n; i++)
		{
			int sum = a[i] + b[i];
			int originalIndex = toIndex.get(sum);
			aNew[originalIndex] = a[i];
			bNew[originalIndex] = b[i];
		}

		// form answer
		ans.append("YES\n");
		ans.append(toString(aNew) + "\n");
		ans.append(toString(bNew) + "\n");

	}

	private String toString(int[] a)
	{
		StringBuilder strb = new StringBuilder();
		for (int x : a)
			strb.append(x + " ");
		return strb.toString().trim();
	}

}

class Item
{
	int value;
	int idx;
}

class InputReader
{
	public BufferedReader reader;
	public StringTokenizer tokenizer;

	public InputReader(InputStream stream)
	{
		reader = new BufferedReader(new InputStreamReader(stream), 32768);
		tokenizer = null;
	}

	public String next()
	{
		while (tokenizer == null || !tokenizer.hasMoreTokens())
		{
			try
			{
				tokenizer = new StringTokenizer(reader.readLine());
			} catch (IOException e)
			{
				throw new RuntimeException(e);
			}
		}
		return tokenizer.nextToken();
	}

}


import java.io.BufferedReader;
import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap;
import java.util.HashSet;
import java.util.StringTokenizer;

import javax.xml.crypto.dsig.spec.XSLTTransformParameterSpec;

public class Main
{

	public static void main(String[] args) throws IOException
	{
		Main main = new Main();
		main.read();
	}

	/* IO */
	private InputReader in;
	private StringBuilder ans;

	/* fields */
	private int n;
	private int[] arr;

	private void read() throws IOException
	{
		// streams
		boolean file = false;
		if (file)
			in = new InputReader(new FileInputStream("Input.txt"));
		else
			in = new InputReader(System.in);
		ans = new StringBuilder();

		// read
		n = Integer.parseInt(in.next());
		arr = new int[n];
		for (int i = 0; i < n; i++)
			arr[i] = Integer.parseInt(in.next());

		// solve
		solve();
		System.out.print(ans.toString());
	}

	private void solve()
	{
		// to get sorted back
		HashMap<Integer, Integer> toIndex = new HashMap<>();
		for (int i = 0; i < n; i++)
			toIndex.put(arr[i], i);

		// first third
		int a[] = new int[n];
		int b[] = new int[n];
		int count1 = n / 3;
		if (3*count1 < n)
			count1++;
		int idx = 0;
		int curr = 0;
		for (int i = 0; i < count1; i++)
		{
			a[idx] = curr++;
			b[idx] = arr[idx] - a[idx];
			idx++;
		}
		int lastA = curr - 1;

		// second third
		int count2 = n / 3;
		if (n/3 + count1 + count2 < n)
			count2++;
		for (int i = 0; i < count2; i++)
		{
			b[idx] = curr++;
			a[idx] = arr[idx] - b[idx];
			idx++;
		}

		// last third
		for (int i = idx; i < n; i++)
		{
			b[i] = lastA--;
			if (b[i] < 0)
				b[i] = 0;
			a[i] = arr[i] - b[i];
		}

		// restor order
		int aNew[] = new int[n];
		int bNew[] = new int[n];
		for (int i = 0; i < n; i++)
		{
			int sum = a[i] + b[i];
			int originalIndex = toIndex.get(sum);
			aNew[originalIndex] = a[i];
			bNew[originalIndex] = b[i];
		}

		// form answer
		ans.append("YES\n");
		ans.append(toString(aNew) + "\n");
		ans.append(toString(bNew) + "\n");

	}

	private String toString(int[] a)
	{
		StringBuilder strb = new StringBuilder();
		for (int x : a)
			strb.append(x + " ");
		return strb.toString().trim();
	}

}

class Item
{
	int value;
	int idx;
}

class InputReader
{
	public BufferedReader reader;
	public StringTokenizer tokenizer;

	public InputReader(InputStream stream)
	{
		reader = new BufferedReader(new InputStreamReader(stream), 32768);
		tokenizer = null;
	}

	public String next()
	{
		while (tokenizer == null || !tokenizer.hasMoreTokens())
		{
			try
			{
				tokenizer = new StringTokenizer(reader.readLine());
			} catch (IOException e)
			{
				throw new RuntimeException(e);
			}
		}
		return tokenizer.nextToken();
	}

}


#include<bits/stdc++.h>
#define rep(i,start,lim) for(lld i=start;i<lim;i++)
#define repd(i,start,lim) for(lld i=start;i>=lim;i--)
#define scan(x) scanf("%lld",&x)
#define print(x) printf("%lld ",x)
#define f first
#define s second
#define pb push_back
#define mp make_pair
#define br printf("\n")
#define sz(a) lld((a).size())
#define YES printf("YES\n")
#define NO printf("NO\n")
#define all(c) (c).begin(),(c).end()
using namespace std;
#define INF         1011111111
#define LLINF       1000111000111000111LL
#define EPS         (double)1e-10
#define MOD         1000000007
#define PI          3.14159265358979323
using namespace std;
typedef long double ldb;
typedef long long lld;
lld powm(lld base,lld exp,lld mod=MOD) {lld ans=1;while(exp){if(exp&1) ans=(ans*base)%mod;exp>>=1,base=(base*base)%mod;}return ans;}
typedef vector<lld> vlld;
typedef pair<lld,lld> plld;
typedef map<lld,lld> mlld;
typedef set<lld> slld;
#define N 100005
vector<plld> v;
lld a[N],b[N];
int main()
{
	lld n;
	cin>>n,v.resize(n);
	rep(i,0,n) cin>>v[i].f,v[i].s=i;
	sort(all(v));
	rep(i,0,n) {
		lld curr=v[i].s;
		if(i<(n/3))            a[curr]=i,    b[curr]=v[i].f - a[curr];
		else if(i<(2*n/3))     b[curr]=i,    a[curr]=v[i].f - b[curr];
		else 				   b[curr]=n-i-1,a[curr]=v[i].f - b[curr];
	}
	YES;
	rep(i,0,n) print(a[i]);br;
	rep(i,0,n) print(b[i]);br;
	return 0;
}


//#pragma GCC optimize("O3")
#include <bits/stdc++.h>
#define enl printf("\n")
#define case(t) printf("Case #%d: ", (t))
#define ni(n) scanf("%d", &(n))
#define nl(n) scanf("%I64d", &(n))
#define nai(a, n) for (int i = 0; i < (n); i++) ni(a[i])
#define nal(a, n) for (int i = 0; i < (n); i++) nl(a[i])
#define pri(n) printf("%d\n", (n))
#define prl(n) printf("%I64d\n", (n))
#define pii pair<int, int>
#define pll pair<long long, long long>
#define vii vector<pii>
#define vi vector<int>
#define pb push_back
#define mp make_pair
#define fi first
#define se second
typedef long long ll;
const double pi = acos(-1);
const int MOD = 1e9 + 7;
const int INF = 1e9 + 7;
const int MAXN = 1e6 + 5;
const double eps = 1e-9;
using namespace std;
int s[MAXN], a[MAXN], b[MAXN], ind[MAXN];
int ans[MAXN][2];

int main()
{
    int n;
    ni(n);
    for (int i = 0; i < n; i++)
    {
        ni(s[i]);
        ind[i] = i;
    }
    sort(ind, ind + n, [](int l, int r) -> bool
         {
            if (s[l] == s[r])
                return l < r;
            return s[l] < s[r];
         });
    sort(s, s + n);
    int x = (n + 2) / 3;
    int y = x + (n + 1) / 3;
    for (int i = 0; i < x; i++)
        a[i] = i, b[i] = s[i] - i;
    for (int i = x; i < y; i++)
        a[i] = s[i] - i, b[i] = i;
    for (int i = y; i < n; i++)
        b[i] = n - i - 1, a[i] = s[i] - b[i];
    for (int i = 0; i < n; i++)
        ans[ind[i]][0] = a[i], ans[ind[i]][1] = b[i];
    printf("YES\n");
    for (int j = 0; j < 2; j++)
        for (int i = 0; i < n; i++)
            if (i == n - 1)
                printf("%d\n", ans[i][j]);
            else
                printf("%d ", ans[i][j]);
    return 0;
}


/*
Take a minute just to breathe
Take a minute 'till I'm wide awake
I'm searching' once again
And the sun has left the sky

And you're on my mind
And you're on my mind

Take a second to believe
Just a second you won't have to wait
Don't you turn your back on me
I couldn't look into your eyes

And I don't know why and I don't know why
But I'll try again on another day

You make my mind
Just wanna leave this world behind
You make my mind, you make my mind

Let the silence creep in
(Let the silence creep in)
In the silence I'm awake all night
Just searching once again
(Searching once again)
Well could I reach you in the morning light

If I closed my eyes, if I closed my eyes
Well you're here right away

You make my mind
Just wanna leave this world behind
You make my mind, you make my mind

You're on my mind
I'll try again on another day

And I don't know why and I don't know why
If I close my eyes, if I close my eyes
Well you're here right away

You make my mind
Just wanna leave this world behind
You make my mind
Just wanna leave this world behind
You make my mind, you make my mind

You make my mind, make my mind
You make my mind, make my mind
You make my mind, make my mind
*/

//#pragma comment(linker, "/STACK:16777216")
#include <fstream>
#include <iostream>
#include <string>
#include <complex>
#include <math.h>
#include <set>
#include <vector>
#include <map>
#include <queue>
#include <stdio.h>
#include <stack>
#include <algorithm>
#include <list>
#include <ctime>
#include <memory.h>
#include <ctime>

#define y0 sdkfaslhagaklsldk
#define y1 aasdfasdfasdf
#define yn askfhwqriuperikldjk
#define j1 assdgsdgasghsf
#define tm sdfjahlfasfh
#define lr asgasgash

#define eps 1e-9
//#define M_PI 3.141592653589793
#define bs 1000000007
#define bsize 256

using namespace std;

vector<pair<int, int> >v;
int n;
int a[1<<20];
int b[1<<20];
int q;

int main(){
//freopen("newlines.in","r",stdin);
//freopen("newlines.out","w",stdout);
//freopen("F:/input.txt","r",stdin);
//freopen("F:/output.txt","w",stdout);
ios_base::sync_with_stdio(0);
//cin.tie(0);

cin>>n;
for (int i=1;i<=n;i++)
{
    cin>>q;
    v.push_back(make_pair(q,i));
}
sort(v.begin(),v.end());
for (int i=0;i<n/3;i++)
{
    int id=v[i].second;
    a[id]=i;
    b[id]=v[i].first-a[id];
}

for (int i=n/3;i<2*n/3;i++)
{
    int id=v[i].second;
    b[id]=i;
    a[id]=v[i].first-b[id];
}

for (int i=2*n/3;i<n;i++)
{
    int id=v[i].second;
    b[id]=n-i-1;
    a[id]=v[i].first-b[id];
}

cout<<"YES"<<endl;
for (int i=1;i<=n;i++)
{
    if (i>1)cout<<" ";
    cout<<a[i];
}
cout<<endl;
for (int i=1;i<=n;i++)
{
    if (i>1)cout<<" ";
    cout<<b[i];
}

//cin.get();cin.get();
return 0;}


#include <bits/stdc++.h>
using namespace std;

vector<pair<int,int> >  vec;
vector<int> a,b;
int main(){
	int n;
	scanf("%d",&n);
	vec.resize(n);
	a.resize(n);
	b.resize(n);
	for(int i=0;i<n;i++){
		scanf("%d",&vec[i].first);
		vec[i].second = i;
	}
	sort(vec.begin(),vec.end());

	for(int i=0;i<n/3;i++){
		a[vec[i].second] = i;
		b[vec[i].second] = vec[i].first - i;
	}

	for(int i=n/3;i<n*2/3;i++){
		b[vec[i].second] = i;
		a[vec[i].second] = vec[i].first - i;
	}

	for(int i=n*2/3;i<n;i++){
		b[vec[i].second] = n-i-1;
		a[vec[i].second] = vec[i].first - (n-i-1);
	}
	puts("YES");
	for(int i=0;i<n;i++)
		printf("%d%c",a[i] , " \n"[i==n-1]);
	for(int i=0;i<n;i++)
		printf("%d%c",b[i] , " \n"[i==n-1]);
}


#include <bits/stdc++.h>
using namespace std;

void P(vector<int> v){
	for(int i=0;i<(int)v.size();i++){
		cout<<v[i]<<" ";
	}
	cout<<endl;
}

vector<int>in;
vector<int>v1,v2;
int main(){
	int n;
	scanf("%d",&n);
	in.resize(n);
	v1.resize(n);
	v2.resize(n);
	for(int i=0;i<n;i++){
		scanf("%d",&in[i]);
		v1[i] = in[i]/2;
		v2[i] = (in[i]+1) / 2;
	}

	if(n == 2 && (v1[0]==v1[1] || v2[0]==v2[1]) && max(in[0],in[1]) < 2){
		puts("NO");
		return 0;
	}
	puts("YES");
	P(v1);
	P(v2);
}


#include <bits/stdc++.h>
using namespace std;

void P(vector<int> v){
	for(int i=0;i<(int)v.size();i++){
		cout<<v[i]<<" ";
	}
	cout<<endl;
}

vector<int>in;
vector<int>v1,v2;
int main(){
	int n;
	scanf("%d",&n);
	in.resize(n);
	v1.resize(n);
	v2.resize(n);
	for(int i=0;i<n;i++){
		scanf("%d",&in[i]);
		v1[i] = in[i]/2;
		v2[i] = (in[i]+1) / 2;
	}

	if(n == 2 && (v1[0]==v1[1] || v2[0]==v2[1])){
		puts("NO");
		return 0;
	}
	puts("YES");
	P(v1);
	P(v2);
}


#include <bits/stdc++.h>
using namespace std;
#define sz size()
#define x first
#define y second
#define mp make_pair
#define mpp(a,b,c) make_pair(make_pair(a,b),c)
#define pb push_back
#define all(v) v.begin(),v.end()
#define EPS 1e-9
#define MOD 1000000007
#define MAX 100005
typedef pair<int,int> pii;
typedef long long ll;

int main()
{
    int n,u;
    scanf("%d",&n);
    vector<pii> v;

    for(int i=0; i<n; i++)
    {
        scanf("%d",&u);
        v.pb(mp(u,i));
    }

    sort(all(v));

    vector<int> a(n),b(n);

    for(int i=0; i<(n + 2) / 3; i++)
    {
        a[v[i].y] = i;
        b[v[i].y] = v[i].x - i;
    }

    for(int i=n - 1; i >= n - (n + 2) / 3; i--)
    {
        b[v[i].y] = i;
        a[v[i].y] = v[i].x - i;
    }

    for(int i=(n + 2) / 3; i < n - (n + 2) / 3; i++)
    {
        a[v[i].y] = i;
        b[v[i].y] = v[i].x - i;
    }

    printf("YES\n");

    for(int i=0; i<n; i++)
    {
        if(i) putchar(' ');
        printf("%d",a[i]);
    }

    printf("\n");

    for(int i=0; i<n; i++)
    {
        if(i) putchar(' ');
        printf("%d",b[i]);
    }
}


#include <bits/stdc++.h>
using namespace std;
#define sz size()
#define x first
#define y second
#define mp make_pair
#define mpp(a,b,c) make_pair(make_pair(a,b),c)
#define pb push_back
#define all(v) v.begin(),v.end()
#define EPS 1e-9
#define MOD 1000000007
#define MAX 100005
typedef pair<int,int> pii;
typedef long long ll;

map<int,int> b;

int main()
{

    bool f1 = 1;
    int n,u;
    scanf("%d",&n);
    vector<pii> v;

    for(int i=0; i<n; i++)
    {
        scanf("%d",&u);
        v.pb(mp(u,i));
    }

    sort(all(v));

    int ai = 0;
    int sum1 = 0;
    int sum2 = 0;

    for(int i=0; i<n; i++)
    {
        if(ai > v[i].x)
        {
            sum1++;
            continue;
        }
        b[v[i].x - ai]++;
        if(b[v[i].x - ai] > 1)
        sum2++;
        ai++;
    }

    if(sum2 > (n + 2) / 3 || sum1 > (n + 2) / 3)
            f1 = 0;

    bool f2 = 1;

    ai = 0;
    sum1 = 0;
    sum2 = 0;

    for(int i = n - 1; i >= 0; i--)
    {
        if(ai > v[i].x)
        {
            sum1++;
            continue;
        }
        b[v[i].x - ai]++;
        if(b[v[i].x - ai] > 1)
        sum2++;
        ai++;
    }

    if(sum2 > (n + 2) / 3 || sum1 > (n + 2) / 3)
            f2 = 0;

    if(!f1 && !f2)
    {
        printf("NO");
        return 0;
    }

    printf("YES\n");

    if(f1)
    {
        ai = 0;
        vector<int> aa(n),bb(n);
        for(int i=0; i<n; i++)
        {
            if(ai > v[i].x)
            {
                aa[v[i].y] = v[i].x;
                bb[v[i].y] = 0;
                ai = v[i].x;
                continue;
            }
            aa[v[i].y] = ai;
            bb[v[i].y] = v[i].x - ai;
            ai++;
        }

        for(int i=0;i<n; i++)
        {
            if(i) printf(" ");
            printf("%d",aa[i]);
        }

        printf("\n");

        for(int i=0;i<n; i++)
        {
            if(i) printf(" ");
            printf("%d",bb[i]);
        }
    }
    else
    {
        ai = 0;
        vector<int> aa(n),bb(n);
        for(int i=n - 1; i >= 0; i--)
        {
            if(ai > v[i].x)
            {
                aa[v[i].y] = v[i].x;
                bb[v[i].y] = 0;
                ai = v[i].x;
                continue;
            }
            aa[v[i].y] = ai;
            bb[v[i].y] = v[i].x - ai;
            ai++;
        }

        for(int i=0;i<n; i++)
        {
            if(i) printf(" ");
            printf("%d",aa[i]);
        }

        printf("\n");

        for(int i=0;i<n; i++)
        {
            if(i) printf(" ");
            printf("%d",bb[i]);
        }
    }

}


#include <bits/stdc++.h>
using namespace std;
#define sz size()
#define x first
#define y second
#define mp make_pair
#define mpp(a,b,c) make_pair(make_pair(a,b),c)
#define pb push_back
#define all(v) v.begin(),v.end()
#define EPS 1e-9
#define MOD 1000000007
#define MAX 100005
typedef pair<int,int> pii;
typedef long long ll;

int main()
{
    int n,u;
    scanf("%d",&n);
    vector<pii> v;

    for(int i=0; i<n; i++)
    {
        scanf("%d",&u);
        v.pb(mp(u,i));
    }

    sort(all(v));

    vector<int> a(n),b(n);

    for(int i=0; i < n/3; i++)
    {
        a[v[i].y] = i;
        b[v[i].y] = v[i].x - i;
    }

    for(int i=n/3; i < 2*n/3; i++)
    {
        b[v[i].y] = i;
        a[v[i].y] = v[i].x - i;
    }

    for(int i=n - 1,j = 0; i >= 2*n/3 ; i--,j++)
    {
        b[v[i].y] = j;
        a[v[i].y] = v[i].x - j;
    }

    printf("YES\n");

    for(int i=0; i<n; i++)
    {
        if(i) putchar(' ');
        printf("%d",a[i]);
    }

    printf("\n");

    for(int i=0; i<n; i++)
    {
        if(i) putchar(' ');
        printf("%d",b[i]);
    }
}


#include<iostream>
#include<cmath>
#include<algorithm>
#include<vector>

using namespace std;

const int MAX = 1e5 + 3;

int n;
int a[MAX], b[MAX];

int main(){
	scanf("%d", &n);
	printf("YES\n");
	int turn = 0;
	for (int i = 0; i < n; i++){
		int temp;	scanf("%d", &temp);
		if (temp % 2 == 1)	turn++;
		if (temp % 2 == 0){
			a[i] = temp/2;
			b[i] = temp/2;
		}
		else{
			int f = temp/ 2, g = temp/ 2 + 1;
			if (turn % 4 < 2){
				a[i] = f;
				b[i] = g;
			}
			else{
				a[i] = g;
				b[i] = f;
			}
		}
	}
	for (int i = 0; i < n; i++)	printf("%d ", a[i]);
	printf("\n");
	for (int i = 0; i < n; i++)	printf("%d ", b[i]);
	printf("\n");
	return 0;
}


#include<iostream>
#include<cmath>
#include<algorithm>
#include<vector>
#include<utility>

using namespace std;

const int MAX = 1e5 + 3;

int n;
int a[MAX], b[MAX];
pair<int, int>	vec[MAX];

int main(){
	scanf("%d", &n);
	printf("YES\n");
	for (int i = 0; i < n; i++){
		scanf("%d", &vec[i].first);
		vec[i].second = i;
	}
	sort(vec, vec + n);

	int turn = 0;
	for (int i = 0; i < n; i++){
		int temp = vec[i].first;
		int j = vec[i].second;

		if (temp % 2 == 1)	turn++;
		if (temp % 2 == 0){
			a[j] = temp/2;
			b[j] = temp/2;
		}
		else{
			int f = temp/ 2, g = temp/ 2 + 1;
			a[j] = f;
			b[j] = g;
		}
	}
	for (int i = 0; i < n; i++)	printf("%d ", a[i]);
	printf("\n");
	for (int i = 0; i < n; i++)	printf("%d ", b[i]);
	printf("\n");
	return 0;
}


#include<iostream>
#include<cmath>
#include<algorithm>
#include<vector>
#include<utility>

using namespace std;

const int MAX = 1e5 + 3;

int n;
int a[MAX], b[MAX];
pair<int, int>	vec[MAX];

int main(){
	scanf("%d", &n);
	printf("YES\n");
	for (int i = 0; i < n; i++){
		scanf("%d", &vec[i].first);
		vec[i].second = i;
	}
	sort(vec, vec + n);

	int turn = 0;
	for (int i = 0; i < n; i++){
		int temp = vec[i].first;
		int j = vec[i].second;
		turn++;

		int f = temp/ 2, g = temp/ 2;
		if (temp % 2)	g++;

/*		if (turn % 3 == 2){
			a[j] = f;
			b[j] = g;
		}*/
		if (turn % 3 == 1){
			a[j] = 0;
			b[j] = temp;
		}
		else{
			a[j] = g;
			b[j] = f;
		}
	}
	for (int i = 0; i < n; i++)	printf("%d ", a[i]);
	printf("\n");
	for (int i = 0; i < n; i++)	printf("%d ", b[i]);
	printf("\n");
	return 0;
}


#include<iostream>
#include<cmath>
#include<algorithm>
#include<vector>
#include<utility>

using namespace std;

const int MAX = 1e5 + 3;

int n;
int a[MAX], b[MAX];
pair<int, int>	vec[MAX];

int main(){
	scanf("%d", &n);
	printf("YES\n");
	for (int i = 0; i < n; i++){
		scanf("%d", &vec[i].first);
		vec[i].second = i;
	}
	sort(vec, vec + n);

	int x = n / 3;
	if (n % 3)	x++;
	for (int i = 0; i < n; i++){
		int temp = vec[i].first;
		int j = vec[i].second;

		if (i < x){
			a[j] = temp;
			b[j] = 0;
		}
		else if (i < 2 * x){
			a[j] = 0;
			b[j] = temp;
		}
		else{
			int t = i - 2 * x;
			b[j] = x - 1 - t;
			a[j] = temp - b[j];
		}
	}

	for (int i = 0; i < n; i++)	printf("%d ", a[i]);
	printf("\n");
	for (int i = 0; i < n; i++)	printf("%d ", b[i]);
	printf("\n");
	return 0;
}


#include<iostream>
#include<cmath>
#include<algorithm>
#include<vector>
#include<utility>

using namespace std;

const int MAX = 1e5 + 3;

int n;
int a[MAX], b[MAX];
pair<int, int>	vec[MAX];

int main(){
	scanf("%d", &n);
	printf("YES\n");
	for (int i = 0; i < n; i++){
		scanf("%d", &vec[i].first);
		vec[i].second = i;
	}
	sort(vec, vec + n);

	int turn = 0;
	for (int i = 0; i < n; i++){
		int temp = vec[i].first;
		int j = vec[i].second;

		if (temp % 2 == 1)	turn++;
		if (temp % 2 == 0){
			a[j] = temp/2;
			b[j] = temp/2;
		}
		else{
			int f = temp/ 2, g = temp/ 2 + 1;
			if (turn % 2 < 1){
				a[j] = f;
				b[j] = g;
			}
			else{
				a[j] = g;
				b[j] = f;
			}
		}
	}
	for (int i = 0; i < n; i++)	printf("%d ", a[i]);
	printf("\n");
	for (int i = 0; i < n; i++)	printf("%d ", b[i]);
	printf("\n");
	return 0;
}


//Let me photograph you in this light
//In case it is the last time
//That we might be exactly like we were
//Before we realized
//We were sad of getting old..

#include<iostream>
#include<cmath>
#include<algorithm>
#include<vector>
#include<utility>

using namespace std;

const int MAX = 1e5 + 3;

int n;
int a[MAX], b[MAX];
pair<int, int>	vec[MAX];

int main(){
	scanf("%d", &n);
	printf("YES\n");
	for (int i = 0; i < n; i++){
		scanf("%d", &vec[i].first);
		vec[i].second = i;
	}
	sort(vec, vec + n);

	int x = n / 3;
	if (n % 3)	x++;
	for (int i = 0; i < n; i++){
		int temp = vec[i].first;
		int j = vec[i].second;

		if (i < x){
			a[j] = temp;
			b[j] = 0;
		}
		else if (i < 2 * x){
			a[j] = 0;
			b[j] = temp;
		}
		else{
			int t = i - 2 * x;
			b[j] = x - 1 - t;
			a[j] = temp - b[j];
		}
	}

	for (int i = 0; i < n; i++)	printf("%d ", a[i]);
	printf("\n");
	for (int i = 0; i < n; i++)	printf("%d ", b[i]);
	printf("\n");
	return 0;
}


#include<iostream>
#include<cmath>
#include<algorithm>
#include<vector>
#include<utility>

using namespace std;

const int MAX = 1e5 + 3;

int n;
int a[MAX], b[MAX];
pair<int, int>	vec[MAX];

int main(){
	scanf("%d", &n);
	printf("YES\n");
	for (int i = 0; i < n; i++){
		scanf("%d", &vec[i].first);
		vec[i].second = i;
	}
	sort(vec, vec + n);

	int turn = 0;
	for (int i = 0; i < n; i++){
		int temp = vec[i].first;
		int j = vec[i].second;
		turn++;

		int f = temp/ 2, g = temp/ 2;
		if (temp % 2)	g++;

		if (turn % 3 == 2){
			a[j] = f;
			b[j] = g;
		}
		if (turn % 3 == 1){
			a[j] = 0;
			b[j] = temp;
		}
		if (turn % 3 == 0){
			a[j] = g;
			b[j] = f;
		}
	}
	for (int i = 0; i < n; i++)	printf("%d ", a[i]);
	printf("\n");
	for (int i = 0; i < n; i++)	printf("%d ", b[i]);
	printf("\n");
	return 0;
}


#include<iostream>
#include<cmath>
#include<algorithm>
#include<vector>

using namespace std;

const int MAX = 1e5 + 3;

int n;
int a[MAX], b[MAX];

int main(){
	scanf("%d", &n);
	printf("YES\n");
	bool turn = 0;
	for (int i = 0; i < n; i++){
		int temp;	scanf("%d", &temp);
		if (temp % 2 == 1)	turn = !turn;
		if (temp % 2 == 0){
			a[i] = temp/2;
			b[i] = temp/2;
		}
		else{
			int f = temp/ 2, g = temp/ 2 + 1;
			if (turn){
				a[i] = f;
				b[i] = g;
			}
			else{
				a[i] = g;
				b[i] = f;
			}
		}
	}
	for (int i = 0; i < n; i++)	printf("%d ", a[i]);
	printf("\n");
	for (int i = 0; i < n; i++)	printf("%d ", b[i]);
	printf("\n");
	return 0;
}


//InTheNameOfGOD

//Fighting_For_A_Lost_Cause

#include <bits/stdc++.h>

#define ll long long
#define F first
#define S second
#define PB push_back
#define pii pair <int, int>
#define Ashar fixed << setprecision(9)
#define Mod 1000000007
#define ppi pair <int, pii>

using namespace std;
const int maxn = 1e5 + 10;
pii a[maxn];
int b[maxn], c[maxn];

int main()
{
	ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
	int n, x;
	cin >> n;
	for(int i = 0; i < n; i++)
	{
		cin >> a[i].F;
		a[i].S = i;
	}
	if(n == 1)
	{
		cout << "YES\n";
		cout << 0 << "\n";
		cout << a[0].F;
		return 0;
	}
	sort(a, a+n);
	int m = (n+2)/3;
	for(int i = 0; i < m; i++)
	{
		x = a[i].S;
		b[x] = i;
		c[x] = a[i].F - b[x];
	}
	for(int i = m; i < 2*m; i++)
	{
		x = a[i].S;
		c[x] = i;
		b[x] = a[i].F - c[x];
	}
	for(int i = 2*m; i < n; i++)
	{
		x = a[i].S;
		c[x] = 3*m-i-1;
		b[x] = a[i].F - c[x];
	}
	cout << "YES\n";
	for(int i = 0; i < n; i++)
		cout << b[i] << " ";
	cout << "\n";
	for(int i = 0; i < n; i++)
	{
		cout << c[i] << " ";
	}
}


// run: $exec < input
#include <iostream>
#include <algorithm>

struct data { int x, id; };

bool operator<(data const & a, data const & b)
{
	return a.x < b.x;
}

int const maxn = 100007;
data da[maxn];
data a[maxn];
data b[maxn];
int n;

int main()
{
	std::cin >> n;
	for (int i = 0; i < n; i++) {
		std::cin >> da[i].x;
		da[i].id = i;
	}
	std::sort(da, da + n);
	for (int i = 0; i < n; i++) a[i].id = b[i].id = da[i].id;

	int d = n / 3;
	for (int i = 0; i < d; i++) {
		a[i].x = i;
		b[i].x = da[i].x - i;
	}
	for (int i = d; i < 2 * d; i++) {
		b[i].x = i;
		a[i].x = da[i].x - i;
	}
	for (int i = 2 * d; i < n; i++) {
		b[i].x = n - i;
		a[i].x = da[i].x - b[i].x;
	}
	std::cout << "YES\n";
	auto cmp = [](data const & a, data const & b) { return a.id < b.id; };
	std::sort(a, a + n, cmp);
	std::sort(b, b + n, cmp);
	for (int i = 0; i < n; i++)
		std::cout << a[i].x << ' ';
	std::cout << '\n';
	for (int i = 0; i < n; i++)
		std::cout << b[i].x << ' ';
}


// run: $exec < input
#include <iostream>
#include <algorithm>

struct data { int x, id; };

bool operator<(data const & a, data const & b)
{
	return a.x < b.x;
}

int const maxn = 100007;
data da[maxn];
data a[maxn];
data b[maxn];
int n;

int main()
{
	std::cin >> n;
	for (int i = 0; i < n; i++) {
		std::cin >> da[i].x;
		da[i].id = i;
	}
	std::sort(da, da + n);
	for (int i = 0; i < n; i++) a[i].id = b[i].id = da[i].id;

	int d = n / 3;
	for (int i = 0; i < d; i++) {
		a[i].x = i;
		b[i].x = da[i].x - i;
	}
	for (int i = d; i < 2 * d; i++) {
		b[i].x = i;
		a[i].x = da[i].x - i;
	}
	for (int i = 2 * d; i < n; i++) {
		b[i].x = n - 1 - i;
		a[i].x = da[i].x - b[i].x;
	}
	std::cout << "YES\n";
	auto cmp = [](data const & a, data const & b) { return a.id < b.id; };
	std::sort(a, a + n, cmp);
	std::sort(b, b + n, cmp);
	for (int i = 0; i < n; i++)
		std::cout << a[i].x << ' ';
	std::cout << '\n';
	for (int i = 0; i < n; i++)
		std::cout << b[i].x << ' ';
}


// run: $exec < input
#include <iostream>
#include <algorithm>

struct data { int x, id; };

bool operator<(data const & a, data const & b)
{
	return a.x < b.x;
}

int const maxn = 100007;
data da[maxn];
data a[maxn];
data b[maxn];
int n;

int main()
{
	std::cin >> n;
	for (int i = 0; i < n; i++) {
		std::cin >> da[i].x;
		da[i].id = i;
	}
	std::sort(da, da + n);
	for (int i = 0; i < n; i++) a[i].id = b[i].id = da[i].id;

	int d = n / 3;
	for (int i = 0; i < d; i++) {
		a[i].x = i;
		b[i].x = da[i].x - i;
	}
	for (int i = d; i < 2 * d; i++) {
		b[i].x = i;
		a[i].x = da[i].x - i;
	}
	for (int i = 2 * d; i < n; i++) {
		a[i].x = n - i;
		b[i].x = da[i].x - a[i].x;
	}
	std::cout << "YES\n";
	auto cmp = [](data const & a, data const & b) { return a.id < b.id; };
	std::sort(a, a + n, cmp);
	std::sort(b, b + n, cmp);
	for (int i = 0; i < n; i++)
		std::cout << a[i].x << ' ';
	std::cout << '\n';
	for (int i = 0; i < n; i++)
		std::cout << b[i].x << ' ';
}


// run: $exec < input
#include <iostream>
#include <algorithm>

struct data { int x, id; };

bool operator<(data const & a, data const & b)
{
	return a.x < b.x;
}

int const maxn = 100007;
data da[maxn];
data a[maxn];
data b[maxn];
int n;

int main()
{
	std::ios::sync_with_stdio(false);
	std::cin >> n;
	for (int i = 0; i < n; i++) {
		std::cin >> da[i].x;
		da[i].id = i;
	}
	std::sort(da, da + n);
	for (int i = 0; i < n; i++) a[i].id = b[i].id = da[i].id;

	int d = n / 3 + ((n % 3) > 0);
	for (int i = 0; i < d; i++) {
		a[i].x = i;
		b[i].x = da[i].x - i;
	}
	for (int i = d; i < 2 * d; i++) {
		b[i].x = i;
		a[i].x = da[i].x - i;
	}
	for (int i = 2 * d; i < n; i++) {
		b[i].x = n - 1 - i;
		a[i].x = da[i].x - b[i].x;
	}
	std::cout << "YES\n";
	auto cmp = [](data const & a, data const & b) { return a.id < b.id; };
	std::sort(a, a + n, cmp);
	std::sort(b, b + n, cmp);
	for (int i = 0; i < n; i++)
		std::cout << a[i].x << ' ';
	std::cout << '\n';
	for (int i = 0; i < n; i++)
		std::cout << b[i].x << ' ';
}


#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define sz(x) ((int)(x).size())
#define rep(i,l,r) for(int i=(l);i<(r);++i)
//-------
#define mp make_pair
const int N = 1e5 + 7;
int n, a[N], b[N];
pair<int, int> s[N];
int main() {
	scanf("%d", &n);
	rep(i, 0, n) {
		int si;
		scanf("%d", &si);
		s[i] = mp(si, i);
	}
	sort(s, s + n);
	int B = n / 3;
	rep(i, 0, B) {
		a[s[i].second] = i;
		b[s[i].second] = s[i].first - i;
	}
	rep(i, B, B << 1) {
		b[s[i].second] = i;
		a[s[i].second] = s[i].first - i;
	}
	rep(i, B << 1, n) {
		b[s[i].second] = n - i - 1;
		a[s[i].second] = s[i].first - b[s[i].second];
	}
	puts("YES");
	rep(i, 0, n)
		printf("%d%c", a[i], " \n"[i == n - 1]);
	rep(i, 0, n)
		printf("%d%c", b[i], " \n"[i == n - 1]);
	return 0;
}


#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define sz(x) ((int)(x).size())
#define rep(i,l,r) for(int i=(l);i<(r);++i)
//-------
#define mp make_pair
const int N = 1e5 + 7;
int n, a[N], b[N];
pair<int, int> s[N];
int main() {
	scanf("%d", &n);
	rep(i, 0, n) {
		int si;
		scanf("%d", &si);
		s[i] = mp(si, i);
	}
	sort(s, s + n);
	int B = (n - 1) / 3 + 1;
	rep(i, B << 1, n) {
		b[s[i].second] = n - i - 1;
		a[s[i].second] = s[i].first - b[s[i].second];
	}
	rep(i, B, B << 1) {
		b[s[i].second] = i;
		a[s[i].second] = s[i].first - i;
	}
	rep(i, 0, B) {
		a[s[i].second] = i;
		b[s[i].second] = s[i].first - i;
	}
	puts("YES");
	rep(i, 0, n)
		printf("%d%c", a[i], " \n"[i == n - 1]);
	rep(i, 0, n)
		printf("%d%c", b[i], " \n"[i == n - 1]);
	return 0;
}


#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define sz(x) ((int)(x).size())
#define rep(i,l,r) for(int i=(l);i<(r);++i)
//-------
#define mp make_pair
const int N = 1e5 + 7;
int n, a[N], b[N];
pair<int, int> s[N];
int main() {
	scanf("%d", &n);
	rep(i, 0, n) {
		int si;
		scanf("%d", &si);
		s[i] = mp(si, i);
	}
	sort(s, s + n);
	int B = (n - 1) / 3 + 1;
	rep(i, 0, B) {
		a[s[i].second] = i;
		b[s[i].second] = s[i].first - i;
	}
	rep(i, B, B << 1) {
		b[s[i].second] = i;
		a[s[i].second] = s[i].first - i;
	}
	rep(i, B << 1, n) {
		b[s[i].second] = n - i - 1;
		a[s[i].second] = s[i].first - b[s[i].second];
	}
	puts("YES");
	rep(i, 0, n)
		printf("%d%c", a[i], " \n"[i == n - 1]);
	rep(i, 0, n)
		printf("%d%c", b[i], " \n"[i == n - 1]);
	return 0;
}


/*
         1~k           k+1~2k          2k+1~n
Bi    0,1,2,...,k-1     Ai-Ci            Ai-Ci
Ci      Ai-Bi       k,k+1,...,2k-1  k-1,...,2,1,0
*/
#include <cstdio>
#include <cctype>
#include <algorithm>
#define gc() getchar()
#define mp std::make_pair
const int N=1e5+5;

int n;
std::pair<int,int> A[N];
struct Answer
{
    int id,b,c;
    bool operator <(const Answer &x)const {return id<x.id;}
}ans[N];

inline int read()
{
    int now=0,f=1;register char c=gc();
    for(;!isdigit(c);c=gc()) if(c=='-') f=-1;
    for(;isdigit(c);now=now*10+c-'0',c=gc());
    return now*f;
}

int main()
{
    n=read();
    for(int i=1; i<=n; ++i) A[i]=mp(read(),i);
    std::sort(A+1,A+1+n);
    int k=(n+2)/3;
    for(int i=1; i<=k; ++i) ans[i].b=i-1, ans[i].c=A[i].first-i+1, ans[i].id=A[i].second;
    for(int i=k+1; i<=k<<1; ++i) ans[i].c=i-1, ans[i].b=A[i].first-i+1, ans[i].id=A[i].second;
    for(int i=k<<1|1; i<=n; ++i) ans[i].c=n-i, ans[i].b=A[i].first-n+i, ans[i].id=A[i].second;
    std::sort(ans+1,ans+1+n);
    puts("YES");
    for(int i=1; i<n; ++i) printf("%d ",ans[i].b);
    printf("%d\n",ans[n].b);
    for(int i=1; i<n; ++i) printf("%d ",ans[i].c);
    printf("%d",ans[n].c);

    return 0;
}//hellobig_tq//hello


/*
         1~k           k+1~2k          2k+1~n
Bi    0,1,2,...,k-1     Ai-Ci            Ai-Ci
Ci      Ai-Bi       k,k+1,...,2k-1  k-1,...,2,1,0
*/
#include <cstdio>
#include <cctype>
#include <algorithm>
#define gc() getchar()
#define mp std::make_pair
const int N=1e5+5;

int n;
std::pair<int,int> A[N];
struct Answer
{
    int id,b,c;
    bool operator <(const Answer &x)const {return id<x.id;}
}ans[N];

inline int read()
{
    int now=0,f=1;register char c=gc();
    for(;!isdigit(c);c=gc()) if(c=='-') f=-1;
    for(;isdigit(c);now=now*10+c-'0',c=gc());
    return now*f;
}

int main()
{
    n=read();
    for(int i=1; i<=n; ++i) A[i]=mp(read(),i);
    std::sort(A+1,A+1+n);
    int k=(n+2)/3;
    for(int i=1; i<=k; ++i) ans[i].b=i-1, ans[i].c=A[i].first-i+1, ans[i].id=A[i].second;
    for(int i=k+1; i<=k<<1; ++i) ans[i].c=i-1, ans[i].b=A[i].first-i+1, ans[i].id=A[i].second;
    for(int i=k<<1|1; i<=n; ++i) ans[i].c=n-i, ans[i].b=A[i].first-n+i, ans[i].id=A[i].second;
    std::sort(ans+1,ans+1+n);
    puts("YES");
    for(int i=1; i<n; ++i) printf("%d ",ans[i].b);
    printf("%d\n",ans[n].b);
    for(int i=1; i<n; ++i) printf("%d ",ans[i].c);
    printf("%d",ans[n].c);

    return 0;
}//hellobig_tq//hello//hello


#include<iostream>
#include<cstdio>
#include<algorithm>
using namespace std;

const int maxn=1e5+100;
struct point
{
      int pos,s,a,b;
}P[maxn];

bool cmp1(  point A, point B ){  return A.s<B.s; }
bool cmp2( point A, point B ){ return A.pos<B.pos; }

int main()
{
      int N; cin>>N;
      for( int i=0; i<N; i++ ) {  cin>>P[i].s; P[i].pos=i;  }
      sort( P,P+N,cmp1  );
      for( int i=0; i<N; i++ )
      {
            if( i<N/3 ) { P[i].a=i; P[i].b=P[i].s-i;  }
            else  if(  i<N*2/3 ) {  P[i].b=i; P[i].a=P[i].s-i; }
            else {  P[i].b=N-i; P[i].a=P[i].s-P[i].b;  }
      }
      sort( P,P+N,cmp2 );
      for( int i=0; i<N; i++ )
      {
            if( i==N-1 )cout<<P[i].a<<endl;
            else cout<<P[i].a<<" ";
      }
      for( int i=0; i<N; i++ )
      {
            if( i==N-1 )cout<<P[i].b<<endl;
            else cout<<P[i].b<<" ";
      }

      return 0;
}


#include<iostream>
#include<cstdio>
#include<algorithm>
using namespace std;

const int maxn=1e5+100;
struct point
{
      int pos,s,a,b;
}P[maxn];

bool cmp1(  point A, point B ){  return A.s<B.s; }
bool cmp2( point A, point B ){ return A.pos<B.pos; }

int main()
{
      int N; cin>>N;
      for( int i=1; i<=N; i++ ) {  cin>>P[i].s; P[i].pos=i;  }
      sort( P+1,P+1+N,cmp1  );

      for(  int i=1; i<=N; i++ )
      {
            if( i<=N/3 ) { P[i].a=i; P[i].b=P[i].s-i; }
            else if(  i<=N*2/3  ){   P[i].b=i; P[i].a=P[i].s-i;  }
            else {  P[i].a=i; P[i].b=P[i].s-i;  }
      }
      sort( P+1,P+1+N,cmp2 );
      cout<<"YES\n";
      for( int i=1; i<=N; i++ )
      {
            if( i==N )cout<<P[i].a<<endl;
            else cout<<P[i].a<<" ";
      }
      for( int i=1; i<=N; i++ )
      {
            if( i==N ) cout<<P[i].b<<endl;
            else cout<<P[i].b<<" ";
      }
      return 0;
}


#include<iostream>
#include<cstdio>
#include<algorithm>
using namespace std;

const int maxn=1e5+100;
struct point
{
      int pos,s,a,b;
}P[maxn];

bool cmp1(  point A, point B ){  return A.s<B.s; }
bool cmp2( point A, point B ){ return A.pos<B.pos; }

int main()
{
      int N; cin>>N;
      for( int i=0; i<N; i++ ) {  cin>>P[i].s; P[i].pos=i;  }
      sort( P,P+N,cmp1  );
      for( int i=0; i<N; i++ )
      {
            if( i<N/3 ) { P[i].a=i; P[i].b=P[i].s-i;  }
            else  if(  i<N*2/3 ) {  P[i].b=i; P[i].a=P[i].s-i; }
            else {  P[i].b=N-i; P[i].a=P[i].s-P[i].b;  }
      }
      sort( P,P+N,cmp2 );
      cout<<"YES\n";
      for( int i=0; i<N; i++ )
      {
            if( i==N-1 )cout<<P[i].a<<endl;
            else cout<<P[i].a<<" ";
      }
      for( int i=0; i<N; i++ )
      {
            if( i==N-1 )cout<<P[i].b<<endl;
            else cout<<P[i].b<<" ";
      }

      return 0;
}


#include<iostream>
#include<cstdio>
#include<algorithm>
using namespace std;

const int maxn=1e5+100;
struct point
{
      int pos,s,a,b;
}P[maxn];

bool cmp1(  point A, point B ){  return A.s<B.s; }
bool cmp2( point A, point B ){ return A.pos<B.pos; }

int main()
{
      int N; cin>>N;
      for( int i=0; i<N; i++ ) {  cin>>P[i].s; P[i].pos=i;  }
      sort( P,P+N,cmp1  );
      for( int i=0; i<N; i++ )
      {
            if( i<N/3 ) { P[i].a=i; P[i].b=P[i].s-i;  }
            else  if(  i<N*2/3 ) {  P[i].b=i; P[i].a=P[i].s-i; }
            else {  P[i].b=N-1-i; P[i].a=P[i].s-P[i].b;  }
      }
      sort( P,P+N,cmp2 );
      cout<<"YES\n";
      for( int i=0; i<N; i++ )
      {
            if( i==N-1 )cout<<P[i].a<<endl;
            else cout<<P[i].a<<" ";
      }
      for( int i=0; i<N; i++ )
      {
            if( i==N-1 )cout<<P[i].b<<endl;
            else cout<<P[i].b<<" ";
      }

      return 0;
}


#include<iostream>
#include<cstdio>
#include<algorithm>
using namespace std;

const int maxn=1e5+100;
struct point
{
      int pos,s,a,b;
}P[maxn];

bool cmp1(  point A, point B ){  return A.s<B.s; }
bool cmp2( point A, point B ){ return A.pos<B.pos; }

int main()
{
      int N; cin>>N;
      for( int i=1; i<=N; i++ ) {  cin>>P[i].s; P[i].pos=i;  }
      sort( P+1,P+1+N,cmp1  );

      for(  int i=1; i<=N; i++ )
      {
            if( i<=N/3 ) { P[i].a=i; P[i].b=P[i].s-i; }
            else if(  i<=N*2/3  ){   P[i].b=i; P[i].a=P[i].s-i;  }
            else {  P[i].b=i-N*2/3; P[i].a=P[i].s-P[i].b;  }
      }
      sort( P+1,P+1+N,cmp2 );
      cout<<"YES\n";
      for( int i=1; i<=N; i++ )
      {
            if( i==N )cout<<P[i].a<<endl;
            else cout<<P[i].a<<" ";
      }
      for( int i=1; i<=N; i++ )
      {
            if( i==N ) cout<<P[i].b<<endl;
            else cout<<P[i].b<<" ";
      }
      return 0;
}


#include <bits/stdc++.h>
using namespace std;
#define pb push_back
#define mp make_pair
#define mod 1000000007
#define h1 7897897897897897
#define h2 7897466719774591
#define b1 98762051
#define b2 98765431
#define inf 1000000000
#define pi 3.1415926535897932384626
#define LMAX 9223372036854775807
#define ll long long
#define fi first
#define sec second
#define pii pair<int, int>
#define pll pair<ll, ll>
#define vi vector<int>
#define vl vector<ll>
#define vp vector<pii>
#define SET(a, b) memset(a, b, sizeof(a));
#define all(x) (x).begin(), (x).end()
#define FF fflush(stdout)
int n, m, k, x, y, sum, cnt;
pair<int, int>ans[100005];
pair<int, int>a[100005];
int main () {
	scanf("%d",&n);
	for (int i=0; i<n; i++) scanf("%d", &a[i].first), a[i].second=i;
	sort(a, a+n);
	for (int i=0; i<n/3; i++) {
		ans[a[i].sec]={i, a[i].fi-i};
	}
	for (int i=n/3; i<n*2/3; i++) {
		ans[a[i].sec]={a[i].fi-i, i};
	}
	for (int i=n*2/3; i<n; i++) {
		ans[a[i].sec]={a[i].fi-n+i, n-i};
	}
	printf("YES\n");
	for (int i=0; i<n; i++) printf("%d ",ans[i].fi);
	printf("\n");
	for (int i=0; i<n; i++) printf("%d ", ans[i].sec);
	printf("\n");
	return 0;
}


#include <bits/stdc++.h>
using namespace std;
#define pb push_back
#define mp make_pair
#define mod 1000000007
#define h1 7897897897897897
#define h2 7897466719774591
#define b1 98762051
#define b2 98765431
#define inf 1000000000
#define pi 3.1415926535897932384626
#define LMAX 9223372036854775807
#define ll long long
#define fi first
#define sec second
#define pii pair<int, int>
#define pll pair<ll, ll>
#define vi vector<int>
#define vl vector<ll>
#define vp vector<pii>
#define SET(a, b) memset(a, b, sizeof(a));
#define all(x) (x).begin(), (x).end()
#define FF fflush(stdout)
int n, m, k, x, y, sum, cnt;
pair<int, int>ans[100005];
pair<int, int>a[100005];
int main () {
	scanf("%d",&n);
	for (int i=0; i<n; i++) scanf("%d", &a[i].first), a[i].second=i;
	sort(a, a+n);
	for (int i=0; i<n/3; i++) {
		ans[a[i].sec]={i, a[i].fi-i};
	}
	for (int i=n/3; i<n*2/3; i++) {
		ans[a[i].sec]={a[i].fi-i, i};
	}
	for (int i=n*2/3; i<n; i++) {
		ans[a[i].sec]={a[i].fi-n+1+i, n-1-i};
	}
	printf("YES\n");
	for (int i=0; i<n; i++) printf("%d ",ans[i].fi);
	printf("\n");
	for (int i=0; i<n; i++) printf("%d ", ans[i].sec);
	printf("\n");
	return 0;
}


#pragma optimize("Ofast")

#include<bits/stdc++.h>
#include<cmath>

using namespace std;

using ll = long long int;
using ull = unsigned long long int;
using dd = double;
using ldd = long double;
using si = short int;
using pii = pair<int, int>;
using pll = pair<ll, ll>;

ll get_seed(string s)
{
    ll ans = 0;
    for (int i = 0; i < s.size(); ++i)
        ans += s[i];
    return ans;
}

#define all(x) (x).begin(), (x).end()
#define ff first
#define ss second

// debug defines
#ifdef HOME
    int jjj;
    #define PO cout << "Pomelo" << endl;
    #define OL cout << "Oliva" << endl;
    #define debug(x) cout << #x << " " << x << endl;
    #define debug_p(x) cout << #x << " " << x.ff << " " << x.ss << endl;
    #define debug_v(x) cout << #x << " "; for (auto ii : x) cout << ii << " "; cout << endl;
    #define debug_vp(x) cout << #x << " "; for (auto ii : x) cout << '[' << ii.ff << " " << ii.ss << ']'; cout << endl;
    #define wait() cin >> jjj;
#else
    #define PO 0;
    #define OL 0;
    #define debug(x) 0;
    #define debug_p(x) 0;
    #define debug_vp(x) 0;
    #define debug_v(x) 0;
    #define debug_vp(x) 0;
    #define wait() 0;
#endif // HOME
// end of debug defines

int main()
{
    ios_base::sync_with_stdio(0);
    cout.tie(0);
    cin.tie(0);

    int n;
    cin >> n;
    vector<pii> arr(n);

    for (int i = 0; i < n; ++i)
    {
        cin >> arr[i].ff;
        arr[i].ss = i;
    }
    vector<pii> a(n), b(n);
    sort(all(arr));
    for (int i = 0; i < (n + 2) / 3; ++i)
    {
        a[i].ff = b[i].ff = arr[i].ss;
        a[i].ss = arr[i].ff;
        b[i].ff = 0;
    }
    int mi = arr[(n + 2) / 3].ff;
    for (int i = (n + 2) / 3; i < ((n + 2) / 3) * 2; ++i)
    {
        a[i].ff = b[i].ff = arr[i].ss;
        b[i].ss = arr[i].ff;
        b[i].ff = 0;
    }
    for (int i = ((n + 2) / 3) * 2, j = 1; i < n; ++i, ++j)
    {
        a[i].ff = b[i].ff = arr[i].ss;
        b[i].ss = mi - j;
        a[i].ss = arr[i].ff - b[i].ss;
    }
    sort(all(a));
    sort(all(b));
    cout << "YES" << '\n';
    for (pii i : a)
        cout << i.ss << " ";
    cout << '\n';
    for (pii i : b)
        cout << i.ss << " ";
    return 0;
}


#pragma optimize("Ofast")

#include<bits/stdc++.h>
#include<cmath>

using namespace std;

using ll = long long int;
using ull = unsigned long long int;
using dd = double;
using ldd = long double;
using si = short int;
using pii = pair<int, int>;
using pll = pair<ll, ll>;

ll get_seed(string s)
{
    ll ans = 0;
    for (int i = 0; i < s.size(); ++i)
        ans += s[i];
    return ans;
}

#define all(x) (x).begin(), (x).end()
#define ff first
#define ss second

// debug defines
#ifdef HOME
    int jjj;
    #define PO cout << "Pomelo" << endl;
    #define OL cout << "Oliva" << endl;
    #define debug(x) cout << #x << " " << x << endl;
    #define debug_p(x) cout << #x << " " << x.ff << " " << x.ss << endl;
    #define debug_v(x) cout << #x << " "; for (auto ii : x) cout << ii << " "; cout << endl;
    #define debug_vp(x) cout << #x << " "; for (auto ii : x) cout << '[' << ii.ff << " " << ii.ss << ']'; cout << endl;
    #define wait() cin >> jjj;
#else
    #define PO 0;
    #define OL 0;
    #define debug(x) 0;
    #define debug_p(x) 0;
    #define debug_vp(x) 0;
    #define debug_v(x) 0;
    #define debug_vp(x) 0;
    #define wait() 0;
#endif // HOME
// end of debug defines

int main()
{
    ios_base::sync_with_stdio(0);
    cout.tie(0);
    cin.tie(0);

    int n;
    cin >> n;
    vector<pii> arr(n);

    for (int i = 0; i < n; ++i)
    {
        cin >> arr[i].ff;
        arr[i].ss = i;
    }
    vector<pii> a(n), b(n);
    sort(all(arr));
    debug_vp(arr);
    for (int i = 0; i < (n + 2) / 3; ++i)
    {
        a[i].ff = b[i].ff = arr[i].ss;
        a[i].ss = i;
        b[i].ss = arr[i].ff - i;
    }
    for (int i = (n + 2) / 3; i < ((n + 2) / 3) * 2; ++i)
    {
        a[i].ff = b[i].ff = arr[i].ss;
        b[i].ss = i;
        a[i].ss = arr[i].ff - i;
    }
    for (int i = ((n + 2) / 3) * 2, j = (n + 2) / 3 - 1; i < n; ++i, --j)
    {
        a[i].ff = b[i].ff = arr[i].ss;
        b[i].ss = j;
        a[i].ss = arr[i].ff - b[i].ss;
    }
    debug_vp(a);
    debug_vp(b);
    sort(all(a));
    sort(all(b));
    cout << "YES" << '\n';
    for (pii i : a)
        cout << i.ss << " ";
    cout << '\n';
    for (pii i : b)
        cout << i.ss << " ";
    return 0;
}


#pragma optimize("Ofast")

#include<bits/stdc++.h>
#include<cmath>

using namespace std;

using ll = long long int;
using ull = unsigned long long int;
using dd = double;
using ldd = long double;
using si = short int;
using pii = pair<int, int>;
using pll = pair<ll, ll>;

ll get_seed(string s)
{
    ll ans = 0;
    for (int i = 0; i < s.size(); ++i)
        ans += s[i];
    return ans;
}

#define all(x) (x).begin(), (x).end()
#define ff first
#define ss second

// debug defines
#ifdef HOME
    int jjj;
    #define PO cout << "Pomelo" << endl;
    #define OL cout << "Oliva" << endl;
    #define debug(x) cout << #x << " " << x << endl;
    #define debug_p(x) cout << #x << " " << x.ff << " " << x.ss << endl;
    #define debug_v(x) cout << #x << " "; for (auto ii : x) cout << ii << " "; cout << endl;
    #define debug_vp(x) cout << #x << " "; for (auto ii : x) cout << '[' << ii.ff << " " << ii.ss << ']'; cout << endl;
    #define wait() cin >> jjj;
#else
    #define PO 0;
    #define OL 0;
    #define debug(x) 0;
    #define debug_p(x) 0;
    #define debug_vp(x) 0;
    #define debug_v(x) 0;
    #define debug_vp(x) 0;
    #define wait() 0;
#endif // HOME
// end of debug defines

int main()
{
    ios_base::sync_with_stdio(0);
    cout.tie(0);
    cin.tie(0);

    int n;
    cin >> n;
    vector<pii> arr(n);

    for (int i = 0; i < n; ++i)
    {
        cin >> arr[i].ff;
        arr[i].ss = i;
    }
    vector<pii> a(n), b(n);
    sort(all(arr));
    debug_vp(arr);
    for (int i = 0; i < (n + 2) / 3; ++i)
    {
        a[i].ff = b[i].ff = arr[i].ss;
        a[i].ss = i;
        b[i].ss = arr[i].ff - i;
    }
    PO;
    for (int i = (n + 2) / 3; i < ((n + 2) / 3) * 2; ++i)
    {
        a[i].ff = b[i].ff = arr[i].ss;
        b[i].ss = i;
        a[i].ss = arr[i].ff - i;
    }
    for (int i = ((n + 2) / 3) * 2, j = (n + 2) / 3 - 1; i < n; ++i, --j)
    {
        a[i].ff = b[i].ff = arr[i].ss;
        b[i].ss = j;
        a[i].ss = arr[i].ff - b[i].ss;
    }
    debug_vp(a);
    debug_vp(b);
    sort(all(a));
    sort(all(b));
    cout << "YES" << '\n';
    for (pii i : a)
        cout << i.ss << " ";
    cout << '\n';
    for (pii i : b)
        cout << i.ss << " ";
    return 0;
}


#pragma optimize("Ofast")

#include<bits/stdc++.h>
#include<cmath>

using namespace std;

using ll = long long int;
using ull = unsigned long long int;
using dd = double;
using ldd = long double;
using si = short int;
using pii = pair<int, int>;
using pll = pair<ll, ll>;

ll get_seed(string s)
{
    ll ans = 0;
    for (int i = 0; i < s.size(); ++i)
        ans += s[i];
    return ans;
}

#define all(x) (x).begin(), (x).end()
#define ff first
#define ss second

// debug defines
#ifdef HOME
    int jjj;
    #define PO cout << "Pomelo" << endl;
    #define OL cout << "Oliva" << endl;
    #define debug(x) cout << #x << " " << x << endl;
    #define debug_p(x) cout << #x << " " << x.ff << " " << x.ss << endl;
    #define debug_v(x) cout << #x << " "; for (auto ii : x) cout << ii << " "; cout << endl;
    #define debug_vp(x) cout << #x << " "; for (auto ii : x) cout << '[' << ii.ff << " " << ii.ss << ']'; cout << endl;
    #define wait() cin >> jjj;
#else
    #define PO 0;
    #define OL 0;
    #define debug(x) 0;
    #define debug_p(x) 0;
    #define debug_vp(x) 0;
    #define debug_v(x) 0;
    #define debug_vp(x) 0;
    #define wait() 0;
#endif // HOME
// end of debug defines

int main()
{
    ios_base::sync_with_stdio(0);
    cout.tie(0);
    cin.tie(0);

    int n;
    cin >> n;
    vector<pii> arr(n);

    for (int i = 0; i < n; ++i)
    {
        cin >> arr[i].ff;
        arr[i].ss = i;
    }
    vector<pii> a(n), b(n);
    sort(all(arr));
    debug_vp(arr);
    for (int i = 0; i < (n + 2) / 3; ++i)
    {
        a[i].ff = b[i].ff = arr[i].ss;
        a[i].ss = arr[i].ff;
        b[i].ss = 0;
    }
    int mi = arr[(n + 2) / 3].ff;
    for (int i = (n + 2) / 3; i < ((n + 2) / 3) * 2; ++i)
    {
        a[i].ff = b[i].ff = arr[i].ss;
        b[i].ss = arr[i].ff;
        a[i].ss = 0;
    }
    for (int i = ((n + 2) / 3) * 2, j = 1; i < n; ++i, ++j)
    {
        a[i].ff = b[i].ff = arr[i].ss;
        b[i].ss = mi - j;
        a[i].ss = arr[i].ff - b[i].ss;
    }
    debug_vp(a);
    debug_vp(b);
    sort(all(a));
    sort(all(b));
    cout << "YES" << '\n';
    for (pii i : a)
        cout << i.ss << " ";
    cout << '\n';
    for (pii i : b)
        cout << i.ss << " ";
    return 0;
}


#pragma optimize("Ofast")

#include<bits/stdc++.h>
#include<cmath>

using namespace std;

using ll = long long int;
using ull = unsigned long long int;
using dd = double;
using ldd = long double;
using si = short int;
using pii = pair<int, int>;
using pll = pair<ll, ll>;

ll get_seed(string s)
{
    ll ans = 0;
    for (int i = 0; i < s.size(); ++i)
        ans += s[i];
    return ans;
}

#define all(x) (x).begin(), (x).end()
#define ff first
#define ss second

// debug defines
#ifdef HOME
    int jjj;
    #define PO cout << "Pomelo" << endl;
    #define OL cout << "Oliva" << endl;
    #define debug(x) cout << #x << " " << x << endl;
    #define debug_p(x) cout << #x << " " << x.ff << " " << x.ss << endl;
    #define debug_v(x) cout << #x << " "; for (auto ii : x) cout << ii << " "; cout << endl;
    #define debug_vp(x) cout << #x << " "; for (auto ii : x) cout << '[' << ii.ff << " " << ii.ss << ']'; cout << endl;
    #define wait() cin >> jjj;
#else
    #define PO 0;
    #define OL 0;
    #define debug(x) 0;
    #define debug_p(x) 0;
    #define debug_vp(x) 0;
    #define debug_v(x) 0;
    #define debug_vp(x) 0;
    #define wait() 0;
#endif // HOME
// end of debug defines

int main()
{
    ios_base::sync_with_stdio(0);
    cout.tie(0);
    cin.tie(0);

    int n;
    cin >> n;
    vector<pii> arr(n);

    for (int i = 0; i < n; ++i)
    {
        cin >> arr[i].ff;
        arr[i].ss = i;
    }
    if (n == 1)
    {
        cout << "YES" << '\n';
        cout << 0 << '\n';
        cout << arr[0].ff;
        return 0;
    }
    vector<pii> a(n), b(n);
    sort(all(arr));
    debug_vp(arr);
    for (int i = 0; i < (n + 2) / 3; ++i)
    {
        a[i].ff = b[i].ff = arr[i].ss;
        a[i].ss = i;
        b[i].ss = arr[i].ff - i;
    }
    for (int i = (n + 2) / 3; i < ((n + 2) / 3) * 2; ++i)
    {
        a[i].ff = b[i].ff = arr[i].ss;
        b[i].ss = i;
        a[i].ss = arr[i].ff - i;
    }
    for (int i = ((n + 2) / 3) * 2, j = (n + 2) / 3 - 1; i < n; ++i, --j)
    {
        a[i].ff = b[i].ff = arr[i].ss;
        b[i].ss = j;
        a[i].ss = arr[i].ff - b[i].ss;
    }
    debug_vp(a);
    debug_vp(b);
    sort(all(a));
    sort(all(b));
    cout << "YES" << '\n';
    for (pii i : a)
        cout << i.ss << " ";
    cout << '\n';
    for (pii i : b)
        cout << i.ss << " ";
    return 0;
}


/*
         1~k           k+1~2k          2k+1~n
Bi    0,1,2,...,k-1     Ai-Ci            Ai-Ci
Ci      Ai-Bi       k,k+1,...,2k-1  k-1,...,2,1,0
*/
#include <cstdio>
#include <cctype>
#include <algorithm>
#define gc() getchar()
#define mp std::make_pair
const int N=1e5+5;

int n;
std::pair<int,int> A[N];
struct Answer
{
    int id,b,c;
    bool operator <(const Answer &x)const {return id<x.id;}
}ans[N];

inline int read()
{
    int now=0,f=1;register char c=gc();
    for(;!isdigit(c);c=gc()) if(c=='-') f=-1;
    for(;isdigit(c);now=now*10+c-'0',c=gc());
    return now*f;
}

int main()
{
    n=read();
    for(int i=1; i<=n; ++i) A[i]=mp(read(),i);
    std::sort(A+1,A+1+n);
    int k=(n+2)/3;
    for(int i=1; i<=k; ++i) ans[i].b=i-1, ans[i].c=A[i].first-i+1, ans[i].id=A[i].second;
    for(int i=k+1; i<=k<<1; ++i) ans[i].c=i-1, ans[i].b=A[i].first-i+1, ans[i].id=A[i].second;
    for(int i=k<<1|1; i<=n; ++i) ans[i].c=n-i, ans[i].b=A[i].first-n+i, ans[i].id=A[i].second;
    std::sort(ans+1,ans+1+n);
    puts("YES");
    for(int i=1; i<n; ++i) printf("%d ",ans[i].b);
    printf("%d\n",ans[n].b);
    for(int i=1; i<n; ++i) printf("%d ",ans[i].c);
    printf("%d",ans[n].c);

    return 0;
}


/*
         1~k           k+1~2k          2k+1~n
Bi    0,1,2,...,k-1     Ai-Ci            Ai-Ci
Ci      Ai-Bi       k,k+1,...,2k-1  k-1,...,2,1,0
*/
#include <cstdio>
#include <cctype>
#include <algorithm>
#define gc() getchar()
#define mp std::make_pair
const int N=1e5+5;

int n;
std::pair<int,int> A[N];
struct Answer
{
    int id,b,c;
    bool operator <(const Answer &x)const {return id<x.id;}
}ans[N];

inline int read()
{
    int now=0,f=1;register char c=gc();
    for(;!isdigit(c);c=gc()) if(c=='-') f=-1;
    for(;isdigit(c);now=now*10+c-'0',c=gc());
    return now*f;
}

int main()
{
    n=read();
    for(int i=1; i<=n; ++i) A[i]=mp(read(),i);
    std::sort(A+1,A+1+n);
    int k=(n+2)/3;
    for(int i=1; i<=k; ++i) ans[i].b=i-1, ans[i].c=A[i].first-i+1, ans[i].id=A[i].second;
    for(int i=k+1; i<=k<<1; ++i) ans[i].c=i-1, ans[i].b=A[i].first-i+1, ans[i].id=A[i].second;
    for(int i=k<<1|1; i<=n; ++i) ans[i].c=n-i, ans[i].b=A[i].first-n+i, ans[i].id=A[i].second;
    std::sort(ans+1,ans+1+n);
    puts("YES");
    for(int i=1; i<n; ++i) printf("%d ",ans[i].b);
    printf("%d\n",ans[n].b);
    for(int i=1; i<n; ++i) printf("%d ",ans[i].c);
    printf("%d",ans[n].c);

    return 0;
}//hellobig_tq


#include <bits/stdc++.h>
#define MAX_N 100010
using namespace std;

int n, a[MAX_N], b[MAX_N], aans[MAX_N], bans[MAX_N];
pair<int,int> arr[MAX_N];

int main(void) {
    ios_base::sync_with_stdio(0);
    cin >> n;
    for (int i=0; i<n; i++) {
        cin >> arr[i].first;
        arr[i].second=i;
    }
    sort(arr,arr+n);
    for (int i=0; i<n/3; i++) {
        a[i]=i;
        b[i]=arr[i].first-a[i];
    }
    for (int i=n/3; i<2*n/3; i++) {
        b[i]=i;
        a[i]=arr[i].first-b[i];
    }
    for (int i=2*n/3; i<n; i++) {
        b[i]=n-i-1;
        a[i]=arr[i].first-b[i];
    }
    for (int i=0; i<n; i++) {
        aans[arr[i].second]=a[i];
        bans[arr[i].second]=b[i];
    }
    cout << "YES\n";
    for (int i=0; i<n; i++) cout << aans[i] << " ";
    cout << "\n";
    for (int i=0; i<n; i++) cout << bans[i] << " ";
    cout << "\n";
    return 0;
}


/*

 ////  /////    /// ////// //  //  ////  //     /// //  // /////  //  // //////
 /  // //      ////   /    //  //  // // //    //// //  // //     //  //   /
 /  // ////   /////   /    //////  // // //   ///// //  // // /// //////   /
 /  // //    //  //   /    //  //  // // //  //  // //  // //  // //  //   /
 ////  //// //   //   /    //  //  //  //// //   // ////// ////// //  //   /

*/

import java.util.*;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.Arrays;
import java.util.StringTokenizer;

/*
* Problem : 238A
* Acknowledgement : None
* Author : deathnaught_
* GitHub : www.github.com/DeathNaughT-GitHub
* Complexity : O(T * 1)
*/

public class A238
{
    static class FastReader
    {

        BufferedReader br;
        StringTokenizer st;

        public FastReader()
        {
            br = new BufferedReader(new InputStreamReader(System.in));
        }

        String next()
        {
            while (st == null || !st.hasMoreElements())
            {
                try
                {
                    st = new StringTokenizer(br.readLine());
                }
                catch (IOException  e)
                {
                    e.printStackTrace();
                }
            }
            return st.nextToken();
        }

		boolean hasNext()
		{
		    return st == null ? false : true;
		}

        char nextChar()
        {
            return next().charAt(0);
        }

        int nextInt()
        {
            return Integer.parseInt(next());
        }

        long nextLong()
        {
            return Long.parseLong(next());
        }

        double nextDouble()
        {
            return Double.parseDouble(next());
        }

        String nextLine()
        {
            String str = "";
            try
            {
                str = br.readLine();
            }
            catch (IOException e)
            {
                e.printStackTrace();
            }
            return str;
        }

        int[] nextArray(int rows)
        {
            int arr[] = new int[rows];
            for (int i = 0; i < rows; i++)
            arr[i] = nextInt();
            return arr;
        }

        long[] nextLongArray(int rows)
        {
            long arr[] = new long[rows];
            for (int i = 0; i < rows; i++)
            arr[i] = nextLong();
            return arr;
        }

        char[] nextCharArray(int rows)
        {
            char arr[] = new char[rows];
            for (int i = 0; i < rows; i++)
            arr[i] = next().charAt(0);
            return arr;
        }

        int[][] nextMatrix(int rows, int columns)
        {
            int mat[][] = new int[rows][columns];
            for (int i = 0; i < rows; i++)
            {
                for (int j = 0; j < columns; j++)
                {
                    mat[i][j] = nextInt();
                }
            }
            return mat;
        }

        char[][] nextCharMatrix(int rows, int columns)
        {
            char mat[][] = new char[rows][columns];
            for (int i = 0; i < rows; i++)
            {
                for (int j = 0; j < columns; j++)
                mat[i][j] = nextChar();
            }
            return mat;
        }
    }

    public static void main(String[] args)
    {
        FastReader sc = new FastReader();

        int N = sc.nextInt();

        String s = sc.next();

        int startRight = s.indexOf('R');
        int startLeft = s.indexOf('L');

        if (startLeft >= 0 && startRight >= 0)
        {
            System.out.println(startRight + 1 + " " + startLeft);
            return;
        }

        if (startLeft == -1)
        {
            int start = s.indexOf('R');
            int end = s.lastIndexOf('R') + 2;
            System.out.println(start + 1 + " " + end);
            return;
        }

        int start = s.lastIndexOf('L');
        int end = s.indexOf('L');
        System.out.println(start + 1 + " " + end);

    }
}


import java.util.Scanner;
public class Main {
    public static void main(String[] args) {
  Scanner sc=new Scanner(System.in);
  int size=sc.nextInt();
  String s=sc.next();
  int start=0;
  int end=0;
  if(s.contains("R")&&s.contains("L")){
      start=s.indexOf("R")+1;
      end=s.indexOf("L");
  }else if(s.contains("R")){
      start=s.indexOf("R")+1;
      end=s.lastIndexOf("R")+2;
  }else if(s.contains("L")){
      start=s.lastIndexOf("L")+1;
      end=s.indexOf("L");
  }
System.out.println(start+" "+end);

    }
}


import java.util.*;
import java.lang.*;

public class Main {

    public static void main(String[] args) {
        Scanner input = new Scanner(System.in);
        int n = input.nextInt();
        String steps = input.next();
        int countR = 0;
        int countL = 0;
        int startPoint = 0;
        int endPoint = 0;

        for (int i = 0; i < steps.length(); i++) {
            if (steps.charAt(i) == 'R') {
                countR++;
            } else if (steps.charAt(i) == 'L') {
                countL++;
            }
        }

        if (countR == 0){
            startPoint = steps.indexOf('L') + 1;
            endPoint = steps.indexOf('L') + 1;
        } else if (countL == 0) {
            startPoint = steps.indexOf('R') + 1;
            endPoint = steps.lastIndexOf('R') + 1;
        } else if (countL > 0 && countR > 0) {
            startPoint = steps.indexOf('R') + 1;
            endPoint = steps.lastIndexOf('R') + 1;
        }

        System.out.println(startPoint + " " + endPoint);
    }
}


import java.util.*;
import java.lang.*;

public class Main {

    public static void main(String[] args) {
        Scanner input = new Scanner(System.in);
        int n = input.nextInt();
        String steps = input.next();
        int countR = 0;
        int countL = 0;
        int startPoint = 0;
        int endPoint = 0;

        for (int i = 0; i < steps.length(); i++) {
            if (steps.charAt(i) == 'R') {
                countR++;
            } else if (steps.charAt(i) == 'L') {
                countL++;
            }
        }

        if (countR == 0){
            startPoint = steps.indexOf('L') + 1;
            endPoint = steps.indexOf('L') ;
        } else if (countL == 0) {
            startPoint = steps.indexOf('R') + 1;
            endPoint = steps.lastIndexOf('R') + 2;
        } else if (countL > 0 && countR > 0) {
            startPoint = steps.indexOf('R') + 1;
            endPoint = steps.lastIndexOf('R') + 1;
        }

        System.out.println(startPoint + " " + endPoint);
    }
}


import java.util.*;
import java.lang.*;

public class SnowPrint{

	public static void main(String[] args) {

		Scanner in = new Scanner(System.in);
		int n = in.nextInt();

		int s =  0;
		int t = 0;
		char[] arr = new char[n];
		arr = in.next().toCharArray();
		boolean flag = false;

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

			if(arr[i] =='R')
			{
				s = i + 1;
				while(arr[++i] == 'R');
				t = i;
				flag = true;
			}
		}

		if(flag)
			System.out.println(s + " " + t);
		else{

			for(int i = n - 1 ; i >= 0 ; i--){

			if(arr[i] =='L')
			{
				s = i + 1;
				while(arr[--i] == 'L');
				t = i;
			}
		}

		System.out.println(s + " " + t);
		}

		}

	}


import java.util.*;
import java.lang.*;

public class SnowPrint{

	public static void main(String[] args) {

		Scanner in = new Scanner(System.in);
		int n = in.nextInt();

		int s =  0;
		int t = 0;
		char[] arr = new char[n];
		arr = in.next().toCharArray();
		boolean flag = false;

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

			if(arr[i] =='R')
			{
				s = i + 1;
				while(arr[++i] == 'R');
				t = i;
				if(arr[i] != 'L')
					t++;
				flag = true;
				break;
			}

		}

		if(flag)
			System.out.println(s + " " + t);
		else{

			for(int i = n - 1 ; i >= 0 ; i--){

			if(arr[i] =='L')
			{
				s = i + 1;
				while(arr[--i] == 'L');
				t = i;
				if(arr[i] != 'R')
					t--;
				break;
			}
		}

		System.out.println(s + " " + t);
		}

		}

	}


import java.util.*;
import java.lang.*;

public class SnowPrint{

	public static void main(String[] args) {

		Scanner in = new Scanner(System.in);
		int n = in.nextInt();

		int s =  0;
		int t = 0;
		char[] arr = new char[n];
		arr = in.next().toCharArray();
		boolean flag = false;

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

			if(arr[i] =='R')
			{
				s = i + 1;
				while(arr[++i] == 'R');
				t = i;
				if(arr[i] != 'L')
					t++;
				flag = true;
				break;
			}

		}

		if(flag)
			System.out.println(s + " " + t);
		else{

			for(int i = n - 1 ; i >= 0 ; i--){

			if(arr[i] =='L')
			{
				s = i + 1;
				while(arr[--i] == 'L');
				t = i + 2;
				if(arr[i] != 'R')
					t--;
				break;
			}
		}

		System.out.println(s + " " + t);
		}

		}

	}


import java.util.*;
import java.math.*;
public class Euler {

	public static void main(String[] args) {

	   Scanner in = new Scanner(System.in);

	   int n = in.nextInt();
	   String str = in.next();

	   int start = -1;
	   int end = -1;
	   boolean b = false;

	   for (int i = 0; i < str.length() - 1; i++) {

		   if (str.charAt(i) == 'R' && str.charAt(i + 1) == 'L' && !b) {

			   end = i + 1;

		   }

		   if (str.charAt(i) == 'L' && str.charAt(i + 1) == '.') {

			   start = i;

		   }

		   if (str.charAt(i) == 'R' && str.charAt(i + 1) == '.') end = i + 1;

		   if (str.charAt(i) == '.' && str.charAt(i + 1) == 'R') start = i + 1;

		   if (str.charAt(i) == '.' && str.charAt(i + 1) == 'L') {

			   end = i;
			   b = true;

		   }

	   }

	   System.out.println((start + 1) + " " + (end + 1));

	}
}


import java.util.*;
import java.math.*;
public class Euler {

	public static void main(String[] args) {

	   Scanner in = new Scanner(System.in);

	   int n = in.nextInt();
	   String str = in.next();

	   int start = -1;
	   int end = -1;
	   boolean b = false;

	   for (int i = 0; i < str.length() - 1; i++) {

		   if (str.charAt(i) == 'R' && str.charAt(i + 1) == 'L' && !b) {

			   end = i + 1;

		   }

		   if (str.charAt(i) == 'L' && str.charAt(i + 1) == '.') {

			   start = i;

		   }

		   if (str.charAt(i) == '.' && str.charAt(i + 1) == 'L') {

			   end = i + 1;
			   b = true;

		   }

	   }

	   System.out.println((start + 1) + " " + (end + 1));

	}
}


import java.util.*;
import java.math.*;
public class Euler {

	public static void main(String[] args) {

	   Scanner in = new Scanner(System.in);

	   int n = in.nextInt();
	   String str = in.next();

	   int start = -1;
	   int end = -1;
	   boolean b = false;

	   for (int i = 0; i < str.length() - 1; i++) {

		   if (str.charAt(i) == 'R' && str.charAt(i + 1) == 'L' && !b) {

			   end = i + 1;

		   }

		   if (str.charAt(i) == 'L' && str.charAt(i + 1) == '.') {

			   start = i;

		   }

		   if (str.charAt(i) == 'R' && str.charAt(i + 1) == '.') end = i + 1;

		   if (str.charAt(i) == '.' && str.charAt(i + 1) == 'R') start = i + 1;

		   if (str.charAt(i) == '.' && str.charAt(i + 1) == 'L') {

			   end = i + 1;
			   b = true;

		   }

	   }

	   System.out.println((start + 1) + " " + (end + 1));

	}
}


import java.util.Scanner;

public class preparation {

	static Scanner sc = new Scanner(System.in);

	public static int getStart(String s, int n)
	{
		int i=0;
		if(s.contains("R"))
		{
			while(s.charAt(i)!='R')
				++i;
			return i+1;
		}
		else
		{
			i=n-1;
			while(s.charAt(i)!='L')
				--i;
			return i+1;
		}
	}
	public static int getEnd(String s, int n)
	{
		int i=0;
		if(s.contains("L"))
		{
			while(s.charAt(i)!='L')
				++i;
			return i;
		}
		else
		{
			i=n-1;
			while(s.charAt(i)!='R')
				--i;
			return i+2;
		}
	}
	public static void main(String[] args) {
		// TODO Auto-generated method stub
		int n=sc.nextInt();
		String s=sc.next();
		System.out.println(getStart(s,n)+" "+getEnd(s,n));
	}

}


import java.util.Scanner;

public class preparation {

	static Scanner sc = new Scanner(System.in);

	public static int getStart(String s, int n)
	{
		int i=0;
		if(s.contains("R"))
		{
			while(s.charAt(i)!='R')
				++i;
			return i+1;
		}
		else
		{
			i=n-1;
			while(s.charAt(i)!='L')
				--i;
			return i+1;
		}
	}
	public static int getEnd(String s, int n)
	{
		int i=0;
		if(s.contains("L"))
		{
			while(s.charAt(i)!='L')
				++i;
			return i;
		}
		else
		{
			i=n-1;
			while(s.charAt(i)!='R')
				--i;
			return i;
		}
	}
	public static void main(String[] args) {
		// TODO Auto-generated method stub
		int n=sc.nextInt();
		String s=sc.next();
		System.out.println(getStart(s,n)+" "+getEnd(s,n));
	}

}


package javaapplication30;
import java.util.Scanner;
public class JavaApplication30 {
public static void main(String[] args) {
 int n,ri=0,li=0,s=0,t=0,tt=0,te=0,x1=0;
 boolean w=false;
        Scanner in= new Scanner(System.in);
    n=in.nextInt();
      char a[]=new char[n];
            a=in.next().toCharArray();
         for (int i = 0; i < n; i++) {
            if(ri==0&&li==0)
                x1++;
             if(a[i]=='R')
             {  ri++;
             tt=i;
             }

             else
                 if(a[i]=='L')
                 { te=i;
                     li++;}

         }
         if(ri>li)
         { s=tt+1;
         t=s+1;}
         else
             if(ri==0)
             {s=te+1;
             t=te-li+1;
             }
             else
             if(li==0)
             {s=te-ri;
             t=te+1;
             }
         else
             if(li>ri)
           {s=te-(li-ri)-1;
             t=tt+li-1;}
         else
             {s=x1;
             t=s+ri-1;
             }
         System.out.println(s+" "+t);

}}


import java.util.Scanner;
public class JavaApplication30 {
public static void main(String[] args) {
 int n,ri=0,li=0,s=0,t=0,tt=0,te=0,x1=0;
 boolean w=false;
        Scanner in= new Scanner(System.in);
    n=in.nextInt();
      char a[]=new char[n];
            a=in.next().toCharArray();
         for (int i = 0; i < n; i++) {
            if(ri==0&&li==0)
                x1++;
             if(a[i]=='R')
             {  ri++;
             tt=i;
             }

             else
                 if(a[i]=='L')
                 { te=i;
                     li++;}

         }
         if(ri>li)
         { s=tt+1;
         t=s+1;}
         else
             if(li>ri)
           {s=te-(li-ri)+1;
             t=tt+(li-ri);}
         else
             {s=x1;
             t=s+ri-1;
             }
         System.out.println(s+" "+t);

}}


import java.util.Scanner;
public class JavaApplication30 {
public static void main(String[] args) {
 int n,ri=0,li=0,s=0,t=0,tt=0,te=0,x1=0;
 boolean w=false;
        Scanner in= new Scanner(System.in);
    n=in.nextInt();
      char a[]=new char[n];
            a=in.next().toCharArray();
         for (int i = 0; i < n; i++) {
            if(ri==0&&li==0)
                x1++;
             if(a[i]=='R')
             {  ri++;
             tt=i;
             }

             else
                 if(a[i]=='L')
                 { te=i;
                     li++;}

         }
         if(ri>li)
         { s=tt+1;
         t=s+1;}
         else
             if(ri==0)
             {s=te+1;
             t=te-li+1;
             }
             else
             if(li==0)
             {s=te-ri;
             t=te+1;
             }
         else
             if(li>ri)
           {s=te-(li-ri)-1;
             t=tt+li-1;}
         else
             {s=x1;
             t=s+ri-1;
             }
         System.out.println(s+" "+t);

}}


import java.util.Scanner;
public class JavaApplication30 {
public static void main(String[] args) {
 int n,ri=0,li=0,s=0,t=0,tt=0,te=0,x1=0;
 boolean w=false;
        Scanner in= new Scanner(System.in);
    n=in.nextInt();
      char a[]=new char[n];
            a=in.next().toCharArray();
         for (int i = 0; i < n; i++) {
            if(ri==0&&li==0)
                x1++;
             if(a[i]=='R')
             {  ri++;
             tt=i;
             }

             else
                 if(a[i]=='L')
                 { te=i;
                     li++;}

         }
         if(ri>li)
         { s=tt+1;
         t=s+1;}
         else
             if(ri==0)
             {s=te+1;
             t=te-li+1;
             }
             else
             if(li==0)
             {s=te-ri;
             t=te+1;
             }
         else
             if(li>ri)
           {s=te-(li-ri)+1;
             t=tt+(li-ri);}
         else
             {s=tt+1;
             t=s+ri+1;
             }
         System.out.println(s+" "+t);

}}


import java.util.Scanner;
public class JavaApplication30 {
public static void main(String[] args) {
 int n,ri=0,li=0,s=0,t=0,tt=0,te=0,x1=0;
 boolean w=false;
        Scanner in= new Scanner(System.in);
    n=in.nextInt();
      char a[]=new char[n];
            a=in.next().toCharArray();
         for (int i = 0; i < n; i++) {
            if(ri==0&&li==0)
                x1++;
             if(a[i]=='R')
             {  ri++;
             tt=i;
             }

             else
                 if(a[i]=='L')
                 { te=i;
                     li++;}

         }
         if(ri>li)
         { s=tt+1;
         t=s+1;}
         else
             if(ri==0)
             {s=te+1;
             t=te-li+1;
             }
         else
             if(li>ri)
           {s=te-(li-ri)+1;
             t=tt+(li-ri);}
         else
             {s=x1;
             t=s+ri-1;
             }
         System.out.println(s+" "+t);

}}


import java.util.Scanner;
public class JavaApplication30 {
public static void main(String[] args) {
 int n,ri=0,li=0,s=0,t=0,tt=0,te=0,x1=0;
 boolean w=false;
        Scanner in= new Scanner(System.in);
    n=in.nextInt();
      char a[]=new char[n];
            a=in.next().toCharArray();
         for (int i = 0; i < n; i++) {
            if(ri==0&&li==0)
                x1++;
             if(a[i]=='R')
             {  ri++;
             tt=i;
             }

             else
                 if(a[i]=='L')
                 { te=i;
                     li++;}

         }
         if(ri>li)
         { s=tt+1;
         t=s+1;}
         else
             if(ri==0)
             {s=te+1;
             t=te-li+1;
             }
             else
             if(li==0)
             {s=te-ri;
             t=te+1;
             }
         else
             if(li>ri)
           {s=te-(li-ri)+1;
             t=tt+(li-ri);}
         else
             {s=x1;
             t=s+ri-1;
             }
         System.out.println(s+" "+t);

}}


import java.util.Scanner;
public class JavaApplication30 {
public static void main(String[] args) {
 int n,ri=0,li=0,s=0,t=0,tt=0,te=0,x1=0;
 boolean w=false;
        Scanner in= new Scanner(System.in);
    n=in.nextInt();
      char a[]=new char[n];
            a=in.next().toCharArray();
         for (int i = 0; i < n; i++) {
            if(ri==0&&li==0)
                x1++;
             if(a[i]=='R')
             {  ri++;
             tt=i;
             }

             else
                 if(a[i]=='L')
                 { te=i;
                     li++;}

         }
         if(ri>li)
         { s=tt+1;
         t=s+1;}
         else
             if(ri==0)
             {s=te+1;
             t=te-li+1;
             }
             else
             if(li==0)
             {s=te-ri;
             t=te+1;
             }
         else
             if(li>ri)
           {s=te-(li-ri)+1;
             t=tt+li-ri;}
         else
             {s=x1;
             t=s+ri-1;
             }
         System.out.println(s+" "+t);

}}


import java.util.Scanner;
public class JavaApplication30 {
public static void main(String[] args) {
 int n,ri=0,li=0,s=0,t=0,tt=0,te=0,x1=0;
 boolean w=false;
        Scanner in= new Scanner(System.in);
    n=in.nextInt();
      char a[]=new char[n];
            a=in.next().toCharArray();
         for (int i = 0; i < n; i++) {
            if(ri==0&&li==0)
                x1++;
             if(a[i]=='R')
             {  ri++;
             tt=i;
             }

             else
                 if(a[i]=='L')
                 { te=i;
                     li++;}

         }
         if(ri>li)
         { s=tt+1;
         t=s+1;}
         else
             if(ri==0)
             {s=te+1;
             t=te-li+1;
             }
             else
             if(li==0)
             {s=te-ri;
             t=te+1;
             }
         else
             if(li>ri)
           {s=x1+2*(ri)-1;
             t=tt+(li-ri);}
         else
             {s=tt;
             t=s+ri;
             }
         System.out.println(s+" "+t);

}
}