#include<iostream>
#include<string>
#include<cmath>
using namespace std;

long long  p[310005];
int cmp(const void *a, const void *b)
{
    if(*(long long*)a > *(long long*)b)
        return 1;
    else
        return -1;
}
int main()
{
    long long n;
    long long i,j;
    long long sum;

    scanf("%I64d", &n);
    for(i=1; i<=n; ++i)
        scanf("%I64d", &p[i]);
    qsort(p+1, n, sizeof(long long), cmp);
    sum = 0;
    for(i=1; i<=n; ++i)
    {
        sum += (p[i]>i ? p[i]-i : i-p[i]);
    }
    printf("%I64d", sum);
    return 0;
}


#include <iostream>
#include <algorithm>
#include <stdio.h>
using namespace std;
long long i,p,n,r,arr[300010];
int main(){
    scanf("%I64d",&n);
    for(i=0;i<n;i++)
        scanf("%I64d",&arr[i]);
    sort(arr,arr+n);
    for(i=0;i<n;i++)
        r+=abs(i+1-arr[i]);
    printf("%I64d\n",r);
    return 0;
}


#include <iostream>
#include <algorithm>
#include <stdio.h>
using namespace std;
long long i,p,r,arr[300010];
int main(){
    scanf("%I64d",&n);
    for(i=0;i<n;i++)
        scanf("%I64d",&arr[i]);
    sort(arr,arr+n);
    for(i=0;i<n;i++)
        r+=abs(i+1-arr[i]);
    printf("%I64d\n",r);
    return 0;
}


#include <iostream>
#include <cmath>

using namespace std;

long n;
long long p[300000];

int main() {

cin >> n;
for (long i=0;i<n;i++) cin >> p[i];

for (long i=0;i<n-1;i++) {
    for (long j=0;j<n-i-1;j++) {
        if (p[i]>p[i+1]) swap(p[i],p[i+1]);
    }
}

long long pp=0;
long nn=n;

for (long i=n-1;i>=0;i--) {
if (nn>p[i]) pp+=nn-p[i]; else pp+=p[i]-nn;
nn--;
}

cout << pp;

    return 0;
}


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

using namespace std;

long n;
long long p[300000];

int main() {

cin >> n;
cin >> p[0];
for (long i=1;i<n;i++) {cin >> p[i];if (p[i]<p[i-1]) swap(p[i],p[i-1]);}

sort(&p[0], &p[n]);

long long pp=0;
long nn=n;

for (long i=n-1;i>=0;i--) {
if (nn>p[i]) pp+=nn-p[i]; else pp+=p[i]-nn;
nn--;
}

cout << pp;

    return 0;
}


#include <iostream>
#include <cmath>

using namespace std;

long n;
long long p[300000];

int main() {

cin >> n;
for (long i=0;i<n;i++) cin >> p[i];

for (long i=1;i<n;i++) {
    for (long j=0;j<n-i;j++) {
        if (p[j]>p[j+1]) swap(p[j],p[j+1]);
    }
}

long long pp=0;
long nn=n;

for (long i=n-1;i>=0;i--) {
if (nn>p[i]) pp+=nn-p[i]; else pp+=p[i]-nn;
nn--;
}

cout << pp;

    return 0;
}


#include <iostream>
using namespace std;

int main() {
    long long n;
    cin >> n;
    long long p = n;
    long long res = 0;
    long long x;
    do {
        cin >> x;
        if (x <= p) {res += n - x;}
        else {res += x - n;}
    } while (--n);

    cout << res;

    return 0;
}


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

int a[300001];
int main() {
    unsigned int n;
    cin >> n;
    long long p = n;
    do { cin >> a[n]; } while (--n);
    sort(a+1, a + p);

    long long res = 0;
    for(int i = 1; i <=p;i++) res += abs(i - a[i]);
    cout << res;
    return 0;
}


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

long long a[300001];
int main() {
    unsigned int n;
    cin >> n;
    long long p = n;
    do { cin >> a[n]; } while (--n);
    sort(a+1, a + p + 1);

    long long res = 0;
    for(int i = 1; i <=p;i++) res += abs(i - a[i]);
    cout << res;
    return 0;
}


#include<iostream>
#include<algorithm>
using namespace std;
int main()
{
    int n; cin >> n;
    int *arr = new int[n];
    for (int i = 0; i < n; i++)
        cin >> arr[i];
    sort(arr, arr + n);
    int x = 1;
    int count = 0;
    for (int i = 0; i < n; i++)
    {
        if (arr[i]>x)
            count+=arr[i]-x;

        else
            count+=x-arr[i];
        x++;
    }
    cout << count << endl;
    return 0;
}


#include<iostream>
#include<algorithm>
using namespace std;
int main()
{
    long long int n; cin >> n;
    long long int *arr = new long long int[n];
    for (int i = 0; i < n; i++)
        cin >> arr[i];
    sort(arr, arr + n);
    long long int x = 1;
    long long int count = 0;
    for (int i = 0; i < n; i++)
    {
        if (arr[i]>x)
            count+=arr[i]-x;

        else
            count+=x-arr[i];
        x++;
    }
    cout << count << endl;
    return 0;
}


#include<iostream>
#include<algorithm>
using namespace std;
int main()
{
    int n; cin >> n;
    int *arr = new int[n];
    for (int i = 0; i < n; i++)
        cin >> arr[i];
    sort(arr, arr + n);
    int x = 1;
    int count = 0;
    for (int i = 0; i < n; i++)
    {
        if (arr[i]>x)
        while (arr[i] > x)
        {
            arr[i]--;
            count++;
        }
        else
         while (arr[i] < x)
        {
            arr[i]++;
            count++;
        }
        x++;
    }
    cout << count << endl;
    return 0;
}


#include<iostream>
#include<cstring>
#include<string>
#include<algorithm>
#include<map>
#include<vector>
#include<set>
#define ll long long
using namespace std;
ll n;
ll a[300100];
int main()
{
	cin >> n;
	for (int i = 0; i < n; i++)cin >> a[i];
	sort(a, a + n);
	ll t = 1;
	ll tot = 0;
	for (int i = 0; i < n; i++)
	{
		if (a[i] == t)
		{
			t++;
		}
		else if (a[i] < t)
		{
			tot += (t - a[i]);
			t++;
		}
		else
		{
			tot += (a[i] - t);
			t++;
		}
		//cout << tot<<endl;
	}

	cout << tot;
	system("pause");
	return 0;
}


#include<iostream>
#include<cstring>
#include<string>
#include<algorithm>
#include<map>
#include<vector>
#include<set>
#define ll long long
using namespace std;
ll n;
ll a[300100];
int main()
{
	cin >> n;
	for (int i = 0; i < n; i++)cin >> a[i];
	sort(a, a + n);
	ll t = 1;
	ll tot = 0;
	for (int i = 0; i < n; i++)
	{
		if (a[i] == t)
		{
			t++;
		}
		else if (a[i] < t)
		{
			tot += (t - a[i]);
			t++;
		}
		else
		{
			tot += (a[i] - t);
			t++;
		}
		//cout << tot<<endl;
	}

	cout << tot;
	//system("pause");
	return 0;
}


# include <iostream>
# include <algorithm>
# include <vector>
using namespace std;
long long a[300000];
void main ()
{
int k,j=0, n,m=0;long long s=0;
cin>>n;
for (int i=0;i<n;i++)cin>>a[i];
vector <int> myvector (a,a+300000);cout<<myvector[100099];
sort (myvector.begin(),myvector.begin()+n);
for(int i=0;i<n;i++)s+=((myvector[n-1-i]>n-i)?(myvector[n-1-i]-n+i):(n-i-myvector[n-1-i]));
cout<<s;
}


# include <iostream>
# include <algorithm>
# include <vector>
using namespace std;
long long a[300000];
void main ()
{
    int k,j=0, n,s=0,m=0;
    cin>>n;
    for (int i=0;i<n;i++)cin>>a[i];
    vector <int> myvector (a,a+300000);
    sort (myvector.begin(),myvector.begin()+n);
for(int i=0;i<n;i++)s+=(myvector[n-1-i]>n-i)?myvector[n-1-i]-n+i:n-i-myvector[n-1-i];cout<<s;
}


# include <iostream>
# include <algorithm>
# include <vector>
using namespace std;
long long a[300000];
void main ()
{
	int k,j=0, n,s=0,m=0;
	cin>>n;
	for (int i=0;i<n;i++)cin>>a[i];
	vector <int> myvector (a,a+n);
	sort (myvector.begin(),myvector.begin()+n);
for(int i=0;i<n;i++)s+=((myvector[n-1-i]>n-i)?(myvector[n-1-i]-n+i):(n-i-myvector[n-1-i]));
cout<<s;
}


# include <iostream>
using namespace std;
long long a[3000000];
void main ()
{
    int k,j=0, n,s=0,m=0;
    cin>>n;
    for (int i=0;i<n;i++)cin>>a[i];
    for (int i=0;i<n;i++)
    {for ( j=0;j<n-1-m;j++)
    if(a[j]>a[j+1]){k=a[j];a[j]=a[j+1];a[j+1]=k;}m++;}
for(int i=0;i<n;i++)s+=(a[n-1-i]>n-i)?a[n-1-i]-n+i:n-i-a[n-1-i];cout<<s;
}


# include <iostream>
# include <algorithm>
# include <vector>
using namespace std;
long long a[300000];
void main ()
{
int k,j=0, n,m=0;long long s=0;
cin>>n;
for (int i=0;i<n;i++)cin>>a[i];
vector <int> myvector (a,a+300000);
sort (myvector.begin(),myvector.begin()+n);
for(int i=0;i<n;i++)s+=((myvector[n-1-i]>n-i)?(myvector[n-1-i]-n+i):(n-i-myvector[n-1-i]));
cout<<s;
}


# include <iostream>
# include <algorithm>
# include <vector>
using namespace std;
long long a[300000];
void main ()
{
    int k,j=0, n,s=0,m=0;
    cin>>n;
    for (int i=0;i<n;i++)cin>>a[i];
    vector <int> myvector (a,a+n);
    sort (myvector.begin(),myvector.begin()+n);for (int i=0;i<n;i++)cout<<myvector[i]<<' ';
for(int i=0;i<n;i++)s+=((myvector[n-1-i]>n-i)?(myvector[n-1-i]-n+i):(n-i-myvector[n-1-i]));
cout<<s;
}


# include <iostream>
using namespace std;
long long f(long long a,long long b)
{
return ((a>b)?a-b:b-a);
}
long long a[3000000];
void main ()
{
	int k,j=0, n,s=0;
	cin>>n;
	for (int i=0;i<n;i++)cin>>a[i];
	for (int i=0;i<n;i++)
	for ( j=0;j<n-1;j++)
		if(a[j]>a[j+1]){k=a[j];a[j]=a[j+1];a[j+1]=k;}
for(int i=0;i<n;i++)s+=f(a[n-1-i],n-i);cout<<s;
}


#include <iostream>
using namespace std;
int partition(int* a, int l, int r)
{
    int p = a[l];
    int i = l - 1;
    int j = r + 1;
    while (1)
    {
        while (a[--j] > p);
        while (a[++i] < p);
        if (i < j) swap(a[i], a[j]);
        else return j;
    }
}
int randPartition(int* a, int l, int r)
{
    swap(a[l], a[rand() % (l + 1) + r - 1]);
    return partition(a, l, r);
}
void qSort(int* a, int l, int r)
{
    if (l >= r) return;
    int s = randPartition(a, l, r);
    qSort(a, l, s);
    qSort(a, s + 1, r);
}
void main()
{
    int n;
    cin >> n;
    int* a = new int[n];
    for (int i = 0; i < n; ++i)
        cin >> a[i];
    qSort(a, 0, n - 1);

    long long int ans = 0;
    for (int i = 0; i < n; i++)
        ans += abs(i - a[i] + 1);
    cout << ans;
}


#include <iostream>

using namespace std;
int partition(int* a, int l, int r)
{
    int p = a[l];
    int i = l - 1;
    int j = r + 1;
    while (1)
    {
        while (a[--j] > p);
        while (a[++i] < p);
        if (i < j) swap(a[i], a[j]);
        else return j;
    }
}
void qSort(int* a, int l, int r)
{
    if (l >= r) return;
    int s = partition(a, l, r);
    qSort(a, l, s);
    qSort(a, s + 1, r);
}
void main()
{
    int n;
    cin >> n;
    int* a = new int[n];
    for (int i = 0; i < n; ++i) cin >> a[i];

    qSort(a, 0, n - 1);
    long long int ans = 0;
    for (int i = 0; i < n; i++)
    {
        if (a[i] == a[i - 1])
        {
            ++a[i];
            ++ans;
        }
        ans += abs(i - a[i] + 1);
    }
    cout << ans;
}


#include <iostream>

using namespace std;
int partition(int* a, int l, int r)
{
    int p = a[l];
    int i = l - 1;
    int j = r + 1;
    while (1)
    {
        while (a[--j] > p);
        while (a[++i] < p);
        if (i < j) swap(a[i], a[j]);
        else return j;
    }
}
void qSort(int* a, int l, int r)
{
    if (l >= r) return;
    int s = partition(a, l, r);
    qSort(a, l, s);
    qSort(a, s + 1, r);
}
void main()
{
    int n;
    cin >> n;
    int* a = new int[n];
    for (int i = 0; i < n; ++i) cin >> a[i];

    qSort(a, 0, n - 1);
    int ans = 0;
    for (int i = 0; i < n; i++)
        ans += abs(i - a[i] + 1);

    cout << ans;
}


#include <iostream>
using namespace std;

void merge(int*a, int l, int m, int r)
{
    int i = l, j = m + 1, k = 0;
    int* temp = new int[r - l + 1];
    while (i <= m && j <= r)
    {
        if (a[i] < a[j])
            temp[k++] = a[i++];
        else
            temp[k++] = a[j++];
    }
    while (i <= m)
        temp[k++] = a[i++];
    while (j <= r)
        temp[k++] = a[j++];
    for (int i = 0; i < r - l + 1; i++)
        a[l + i] = temp[i];
}
void mergeSort(int* a, int l, int r)
{
    if (l >= r) return;
    int m = l - (l - r) / 2;
    mergeSort(a, l, m);
    mergeSort(a, m + 1, r);
    merge(a, l, m, r);
}
void main()
{
    int n;
    cin >> n;
    int* a = new int[n];
    for (int i = 0; i < n; ++i)
        cin >> a[i];
    mergeSort(a, 0, n - 1);

    long long int ans = 0;
    for (int i = 0; i < n; i++)
        ans += abs(i - a[i] + 1);
    cout << ans;
}


#include <iostream>

using namespace std;
int partition(int* a, int l, int r)
{
    int p = a[l];
    int i = l - 1;
    int j = r + 1;
    while (1)
    {
        while (a[--j] > p);
        while (a[++i] < p);
        if (i < j) swap(a[i], a[j]);
        else return j;
    }
}
void qSort(int* a, int l, int r)
{
    if (l >= r) return;
    int s = partition(a, l, r);
    qSort(a, l, s);
    qSort(a, s + 1, r);
}
void main()
{
    int n;
    cin >> n;
    int* a = new int[n];
    for (int i = 0; i < n; ++i) cin >> a[i];

    qSort(a, 0, n - 1);
    int ans = 0;
    for (int i = 0; i < n; i++)
    {
        if (a[i] == a[i - 1])
        {
            ++a[i];
            ++ans;
        }
        ans += abs(i - a[i] + 1);
    }
    cout << ans;
}


#include <iostream>
using namespace std;
int partition(int* a, int l, int r)
{
    int p = a[l];
    int i = l - 1;
    int j = r + 1;
    while (1)
    {
        while (a[--j] > p);
        while (a[++i] < p);
        if (i < j) swap(a[i], a[j]);
        else return j;
    }
}
void qSort(int* a, int l, int r)
{
    if (l >= r) return;
    int s = partition(a, l, r);
    qSort(a, l, s);
    qSort(a, s + 1, r);
}
void main()
{
    int n;
    cin >> n;
    int* a = new int[n];
    for (int i = 0; i < n; ++i)
        cin >> a[i];

    qSort(a, 0, n - 1);
    long long int ans = 0;
    for (int i = 0; i < n; i++)
        ans += abs(i - a[i] + 1);
    cout << ans;
}


#include <iostream>
using namespace std;
int partition(int* a, int l, int r)
{
    int p = a[l];
    int i = l - 1;
    int j = r + 1;
    while (1)
    {
        while (a[--j] > p);
        while (a[++i] < p);
        if (i < j) swap(a[i], a[j]);
        else return j;
    }
}
void qSort(int* a, int l, int r)
{
    if (l >= r) return;
    int s = partition(a, l, r);
    qSort(a, l, s);
    qSort(a, s + 1, r);
}
void main()
{
    int n;
    cin >> n;
    int* a = new int[n];
    int sorted = 1;
    for (int i = 0; i < n; ++i)
    {
        cin >> a[i];
        if (i && a[i] < a[i - 1])
            sorted = 0;
    }
    if (!sorted)
        qSort(a, 0, n - 1);
    long long int ans = 0;
    for (int i = 0; i < n; i++)
        ans += abs(i - a[i] + 1);
    cout << ans;
}


#include <iostream>
using namespace std;
int partition(int* a, int l, int r)
{
    int p = a[l - (l - r) / 2];
    int i = l - 1;
    int j = r + 1;
    while (1)
    {
        while (a[--j] > p);
        while (a[++i] < p);
        if (i < j) swap(a[i], a[j]);
        else return j;
    }
}
void qSort(int* a, int l, int r)
{
    if (l >= r) return;
    int s = partition(a, l, r);
    qSort(a, l, s);
    qSort(a, s + 1, r);
}
void main()
{
    int n;
    cin >> n;
    int* a = new int[n];
    for (int i = 0; i < n; ++i)
        cin >> a[i];

    qSort(a, 0, n - 1);
    long long int ans = 0;
    for (int i = 0; i < n; i++)
        ans += abs(i - a[i] + 1);
    cout << ans;
}


#include <iostream>
#include <string>
#include <sstream>
#include <algorithm>
#include <vector>
#include <set>
#include <map>
#include <math.h>
#include <queue>
#include <cstdio>

#define sqr(t) ((t)*(t))
#define INF INT_MAX
using namespace std;

long long int i, j, ans, t, a, b, Ansa, Ansb, p, D, x, c, arr[10000000], arr2[10000000], s, f;
long long int k, n, z;

int main ()
{
    #ifndef ONLINE_JUDGE
        freopen("input.txt", "r", stdin);
        freopen("output.txt", "w", stdout);
    #endif
    cin>>n;
    for (i=0; i<n; i++)
    {
        scanf("%I64d", &arr[i]);
        if ((arr[i]<=n) && (arr[i]>=1))
            arr2[arr[i]]++;
    }
    sort(arr, arr+n);
    p=1;

    for (i=0; i<n; i++)
    {
        while (arr2[p]>0)
            p++;
        if ((arr[i]<=n) && (arr[i]>=1))
        if (arr2[arr[i]]>1)
        {
            ans+=abs(arr[i]-p+0.0);
            arr2[arr[i]]--;
            arr2[p]=1;
        }

        if ((arr[i]>n) || (arr[i]<1))
        {
            if (arr[i]<=0)
            {
                ans+=abs(arr[i]+0.0)+p;
                arr2[p]=1;
            }
            else
            {
                ans+=abs(arr[i]+0.0)-p;
                arr2[p]=1;
            }
        }
    }

    cout<<ans;

}


#include <iostream>
#include <string>
#include <sstream>
#include <algorithm>
#include <vector>
#include <set>
#include <map>
#include <math.h>
#include <queue>
#include <cstdio>

#define sqr(t) ((t)*(t))
#define INF INT_MAX
using namespace std;

long long int i, j, ans, t, a, b, Ansa, Ansb, p, D, x, c, arr[10000000], arr2[10000000], s, f;
long long int k, n, z;

int main ()
{
    #ifndef ONLINE_JUDGE
        freopen("input.txt", "r", stdin);
        freopen("output.txt", "w", stdout);
    #endif
    cin>>n;
    for (i=0; i<n; i++)
    {
        scanf("%I64d", &arr[i]);
        if ((arr[i]<=n) && (arr[i]>=1))
            arr2[arr[i]]++;
    }
    sort(arr, arr+n);
    p=1;
    for (i=0; i<n; i++)
    if ((arr[i]>n) || (arr[i]<1) || (arr2[arr[i]]>1))
    {
        while (arr2[p]>0)
            p++;
        if ((arr2[arr[i]]>1) && (arr[i]<=n) && (arr[i]>=1))
        {
            ans+=abs(arr[i]-p+0.0);
            arr2[arr[i]]--;
            arr2[p]=1;
        }
        else
        if (arr[i]<=0)
        {
            ans+=abs(arr[i]+0.0)+p;
            arr2[p]=1;
        }
        else
        {
            ans+=abs(arr[i]+0.0)-p;
            arr2[p]=1;
        }
    }
    cout<<ans;

}


#include <iostream>
#include <string>
#include <sstream>
#include <algorithm>
#include <vector>
#include <set>
#include <map>
#include <math.h>
#include <queue>
#include <cstdio>

#define sqr(t) ((t)*(t))
#define INF INT_MAX
using namespace std;

long long int i, j, ans, t, a, b, Ansa, Ansb, p, D, x, c, arr[10000000], arr2[10000000], s, f;
long long int k, n, z;

int main ()
{
    #ifndef ONLINE_JUDGE
        freopen("input.txt", "r", stdin);
        freopen("output.txt", "w", stdout);
    #endif
    cin>>n;
    for (i=0; i<n; i++)
    {
        cin>>arr[i];
        if ((arr[i]<=n) && (arr[i]>=1))
            arr2[arr[i]]=1;
    }
    sort(arr, arr+n);
    p=1;
    for (i=0; i<n; i++)
    if ((arr[i]>n) || (arr[i]<1))
    {
        while (arr2[p]==1)
            p++;
        if (arr[i]<=0)
        {
            ans+=abs(arr[i]+0.0)+p;
            arr2[p]=1;
        }
        else
        {
            ans+=abs(arr[i]+0.0)-p;
            arr2[p]=1;
        }
    }
    cout<<ans;

}


#include <iostream>
#include <string>
#include <sstream>
#include <algorithm>
#include <vector>
#include <set>
#include <map>
#include <math.h>
#include <queue>
#include <cstdio>

#define sqr(t) ((t)*(t))
#define INF INT_MAX
using namespace std;

long long int i, j, ans, t, a, b, Ansa, Ansb, p, D, x, c, arr[10000000], arr2[10000000], s, f;
long long int k, n, z;

int main ()
{
    #ifndef ONLINE_JUDGE
        freopen("input.txt", "r", stdin);
        freopen("output.txt", "w", stdout);
    #endif
    cin>>n;
    for (i=0; i<n; i++)
    {
        scanf("%d", &arr[i]);
        if ((arr[i]<=n) && (arr[i]>=1))
            arr2[arr[i]]++;
    }
    sort(arr, arr+n);
    p=1;
    for (i=0; i<n; i++)
    if ((arr[i]>n) || (arr[i]<1) || (arr2[arr[i]]>1))
    {
        while (arr2[p]>0)
            p++;
        if (arr2[arr[i]]>1)
        {
            ans+=abs(arr[i]-p+0.0);
            arr2[arr[i]]--;
            arr2[p]=1;
        }
        else
        if (arr[i]<=0)
        {
            ans+=abs(arr[i]+0.0)+p;
            arr2[p]=1;
        }
        else
        {
            ans+=abs(arr[i]+0.0)-p;
            arr2[p]=1;
        }
    }
    cout<<ans;

}


#include <iostream>
#include <string>
#include <sstream>
#include <algorithm>
#include <vector>
#include <set>
#include <map>
#include <math.h>
#include <queue>
#include <cstdio>

#define sqr(t) ((t)*(t))
#define INF INT_MAX
using namespace std;

long long int i, j, ans, t, a, b, Ansa, Ansb, p, D, x, c, arr[10000000], arr2[10000000], s, f;
long long int k, n, z;

int main ()
{
    #ifndef ONLINE_JUDGE
        freopen("input.txt", "r", stdin);
        freopen("output.txt", "w", stdout);
    #endif
    cin>>n;
    for (i=0; i<n; i++)
    {
        scanf("%I64d", &arr[i]);
        if ((arr[i]<=n) && (arr[i]>=1))
            arr2[arr[i]]++;
    }
    sort(arr, arr+n);
    p=1;
    for (i=0; i<n; i++)
    if ((arr[i]>n) || (arr[i]<1) || (arr2[arr[i]]>1))
    {
        while (arr2[p]>0)
            p++;
        if ((arr[i]<=n) && (arr[i]>=1))
        if (arr2[arr[i]]>1)
        {
            ans+=abs(arr[i]-p+0.0);
            arr2[arr[i]]--;
            arr2[p]=1;
        }
        else
        if (arr[i]<=0)
        {
            ans+=abs(arr[i]+0.0)+p;
            arr2[p]=1;
        }
        else
        {
            ans+=abs(arr[i]+0.0)-p;
            arr2[p]=1;
        }
    }
    cout<<ans;

}


#include <iostream>
#include <string>
#include <sstream>
#include <algorithm>
#include <vector>
#include <set>
#include <map>
#include <math.h>
#include <queue>
#include <cstdio>

#define sqr(t) ((t)*(t))
#define INF INT_MAX
using namespace std;

long long int i, j, ans, t, a, b, Ansa, Ansb, p, D, x, c, arr[10000000], arr2[10000000], s, f;
long long int k, n, z;

int main ()
{
    #ifndef ONLINE_JUDGE
        freopen("input.txt", "r", stdin);
        freopen("output.txt", "w", stdout);
    #endif
    cin>>n;
    for (i=0; i<n; i++)
    {
        cin>>arr[i];
        if ((arr[i]<=n) && (arr[i]>=1))
            arr2[arr[i]]++;
    }
    sort(arr, arr+n);
    p=1;
    for (i=0; i<n; i++)
    if ((arr[i]>n) || (arr[i]<1) || (arr2[arr[i]]>1))
    {
        while (arr2[p]>0)
            p++;
        if (arr2[arr[i]]>1)
        {
            ans+=abs(arr[i]-p+0.0);
            arr2[arr[i]]--;
            arr2[p]=1;
        }
        else
        if (arr[i]<=0)
        {
            ans+=abs(arr[i]+0.0)+p;
            arr2[p]=1;
        }
        else
        {
            ans+=abs(arr[i]+0.0)-p;
            arr2[p]=1;
        }
    }
    cout<<ans;

}


#include <iostream>
#include <string>
#include <sstream>
#include <algorithm>
#include <vector>
#include <set>
#include <map>
#include <math.h>
#include <queue>
#include <cstdio>

#define sqr(t) ((t)*(t))
#define INF INT_MAX
using namespace std;

long long int i, j, ans, t, a, b, Ansa, Ansb, p, D, x, c, arr[10000000], arr2[10000000], s, f;
long long int k, n, z;

int main ()
{
    #ifndef ONLINE_JUDGE
        freopen("input.txt", "r", stdin);
        freopen("output.txt", "w", stdout);
    #endif
    cin>>n;
    for (i=0; i<n; i++)
    {
        scanf("%I64d", &arr[i]);
        if ((arr[i]<=n) && (arr[i]>=1))
            arr2[arr[i]]++;
    }
    sort(arr, arr+n);
    p=1;
    for (i=0; i<n; i++)
    if ((arr[i]>n) || (arr[i]<1) || (arr2[arr[i]]>1))
    {
        while (arr2[p]>0)
            p++;
        if (arr2[arr[i]]>1)
        {
            ans+=abs(arr[i]-p+0.0);
            arr2[arr[i]]--;
            arr2[p]=1;
        }
        else
        if (arr[i]<=0)
        {
            ans+=abs(arr[i]+0.0)+p;
            arr2[p]=1;
        }
        else
        {
            ans+=abs(arr[i]+0.0)-p;
            arr2[p]=1;
        }
    }
    cout<<ans;

}


#include <iostream>
#include <string>
#include <sstream>
#include <algorithm>
#include <vector>
#include <set>
#include <map>
#include <math.h>
#include <queue>
#include <cstdio>

#define sqr(t) ((t)*(t))
#define INF INT_MAX
using namespace std;

long long int i, j, ans, t, a, b, Ansa, Ansb, p, D, x, c, arr[10000000], arr2[10000000], s, f;
long long int k, n, z;

int main ()
{
    #ifndef ONLINE_JUDGE
        freopen("input.txt", "r", stdin);
        freopen("output.txt", "w", stdout);
    #endif
    cin>>n;
    for (i=0; i<n; i++)
    {
        scanf("%I64d", &arr[i]);
        if ((arr[i]<=n) && (arr[i]>=1))
            arr2[arr[i]]++;
    }
    sort(arr, arr+n);
    p=1;
    for (i=0; i<n; i++)
    if ((arr[i]>n) || (arr[i]<1) || (arr2[arr[i]]>1))
    {
        while (arr2[p]>0)
            p++;
        if ((arr[i]<=n) || (arr[i]>=1))
        if (arr2[arr[i]]>1)
        {
            ans+=abs(arr[i]-p+0.0);
            arr2[arr[i]]--;
            arr2[p]=1;
        }
        else
        if (arr[i]<=0)
        {
            ans+=abs(arr[i]+0.0)+p;
            arr2[p]=1;
        }
        else
        {
            ans+=abs(arr[i]+0.0)-p;
            arr2[p]=1;
        }
    }
    cout<<ans;

}


#include <iostream>
#include <algorithm>
using namespace std;
long long a[300002],n,k=0;

int main()
{
	cin >> n;
	for (int i=1; i<=n; ++i)
		cin >> a[i];

	sort(&a[1], &a[n+1]);
	for (int i=1; i<=n; ++i)
		k=k+abs(i-a[i]);
	cout << k << endl;

	return 0;
}


#include <iostream>
using namespace std;
int a[300001],p[300001],n,k=0;
int main()
{
	cin >> n;
	for (int i=1; i<=n; ++i)
	{
		cin >> a[i];
		p[i]=i;
	}
	for (int i=1; i<=n; ++i)
		for (int j=1; j<n; ++j)
			if (a[p[j]]>a[p[j+1]]) swap(p[i],p[i+1]);
	for (int i=1; i<=n; ++i)
		k=k+abs(i-a[p[i]]);
	cout << k << endl;

	return 0;
}


#include <iostream>
#include <algorithm>
using namespace std;
int a[300002],p[300002],n,k=0;

int main()
{
	cin >> n;
	for (int i=1; i<=n; ++i)
	{
		cin >> a[i];
		p[i]=i;
	}

	sort(&a[1], &a[n+1]);
	for (int i=1; i<=n; ++i)
		k=k+abs(i-a[i]);
	cout << k << endl;

	return 0;
}


#include <iostream>
#include <stdio.h>
#include <stdlib.h>
#include <algorithm>
#include <conio.h>

using namespace std;

long a[400000];

int main()
{
	long n; long long suma=0,ans=0,up=0,down=0,_min;
	scanf("%ld",&n);
	for (int i=1; i<=n; ++i) scanf("%ld",&a[i]);
	//for (int i=1; i<=n; ++i) printf("%ld ",a[i]);
	sort(a+1,a+(n+1));
	//for (int i=1; i<=n; ++i) printf("%ld ",a[i]);
	//printf("\n");
	//_getch();
	for (int i=1; i<=n; ++i)
	{
		if (a[i]<i) down+=i-a[i];
		else up+=a[i]-i;
		_min=min(down,up);
		ans+=_min;
		down-=_min;
		up-=_min;
		//printf("%lld %lld %lld %lld %ld \n",llabs(i-a[i]),ans,up,down,a[i]);
		//_getch();
	}
	ans+=up+down;
	printf("%I64d",ans);
	_getch();
	return 0;
}


#include <iostream>
#include <stdio.h>
#include <stdlib.h>
#include <algorithm>
#include <conio.h>

using namespace std;

long a[400000];

int main()
{
	long n; long long suma=0,ans=0,up=0,down=0,_min;
	scanf("%ld",&n);
	for (int i=1; i<=n; ++i) scanf("%ld",&a[i]);
	//for (int i=1; i<=n; ++i) printf("%ld ",a[i]);
	sort(a+1,a+(n+1));
	//for (int i=1; i<=n; ++i) printf("%ld ",a[i]);
	//printf("\n");
	//_getch();
	for (int i=1; i<=n; ++i)
	{
		if (a[i]<i) down+=i-a[i];
		else up+=a[i]-i;
		_min=min(down,up);
		ans+=_min;
		down-=_min;
		up-=_min;
		//printf("%lld %lld %lld %lld %ld \n",llabs(i-a[i]),ans,up,down,a[i]);
		//_getch();
	}
	ans+=up+down;
	printf("%I64d",ans);
	//_getch();
	return 0;
}


#include <iostream>
#include <stdio.h>
#include <stdlib.h>
#include <algorithm>
#include <conio.h>

using namespace std;

long a[400000];

int main()
{
	long n; long long suma=0,ans=0,up=0,down=0,_min;
	scanf("%ld",&n);
	for (int i=1; i<=n; ++i) scanf("%ld",&a[i]);
	sort(a+1,a+(n+1));
	for (int i=1; i<=n; ++i) ans+=llabs(a[i]-i);
	printf("%I64d",ans);
	return 0;
}


#include<iostream>
#include<cstdio>
#include<cmath>
#include<cstring>
using namespace std;
int a[100006];
int vis[100006];
int n,s,t;
int main()
{
    cin>>n;
    for(int i=1;i<=n;i++)
        scanf("%d",&a[i]);
    __int64 num=0,minn=0;
    for(int i=1;i<=n;i++)
        num+=abs(i-a[i]);
    minn=num;
    num=0;
    for(int i=n;i>=1;i--)
        num+=abs(i-a[i]);
    if(num<minn) minn=num;
    printf("%d\n",minn);

}


#include<iostream>
#include<cstdio>
#include<cmath>
#include<cstring>
using namespace std;
int a[100006];
int vis[100006];
int n,s,t;
int main()
{
    cin>>n;
    for(int i=1;i<=n;i++)
        scanf("%d",&a[i]);
    __int64 num=0,minn=0;
    for(int i=1;i<=n;i++)
        num+=abs(i-a[i]);
    minn=num;
    num=0;
    for(int i=n;i>=1;i--)
        num+=abs(i-a[i]);
    if(num<minn) minn=num;
    printf("%I64d\n",minn);
    return 0;
}


#include<iostream>
#include<cstdio>
#include<cmath>
#include<cstring>
#include<algorithm>
using namespace std;
int a[400006];
int vis[100006];
int n,s,t;
int cmp(int a,int b)
{
    return a>b;
}
int main()
{
    cin>>n;
    for(int i=1;i<=n;i++)
        scanf("%d",&a[i]);
    sort(a+1,a+n+1);
    __int64 num=0,minn=0;
    for(int i=1;i<=n;i++)
        num+=abs(i-a[i]);
    minn=num;
    num=0;
    sort(a+1,a+1+n,cmp);
    for(int i=n;i>=1;i--)
        num+=abs(i-a[i]);
    if(num<minn) minn=num;
    printf("%I64d\n",minn);
    return 0;
}


#include<iostream>
#include<cstdio>
#include<cmath>
#include<cstring>
#include<algorithm>
using namespace std;
int a[100006];
int vis[100006];
int n,s,t;
int cmp(int a,int b)
{
    return a>b;
}
int main()
{
    cin>>n;
    for(int i=1;i<=n;i++)
        scanf("%d",&a[i]);
    sort(a+1,a+n+1);
    __int64 num=0,minn=0;
    for(int i=1;i<=n;i++)
        num+=abs(i-a[i]);
    minn=num;
    num=0;
    sort(a+1,a+1+n,cmp);
    for(int i=n;i>=1;i--)
        num+=abs(i-a[i]);
    if(num<minn) minn=num;
    printf("%I64d\n",minn);
    return 0;
}


#include <iostream>
using namespace std;
int main()
{
    long long int n,last=0,temp;
    int *supposed,*actual;
    cin >>n;
    supposed=new int [n];
    actual=new int [n];
    supposed[0]=1;
    for (int i=0;i<n;i++)
    {
        cin >>actual[i];
        if (i<n-1)
            supposed[i+1]=n-i;
    }
    if (n==2)
    {
        if (actual[0]>actual[1])
        {
            temp=actual[0];
            actual[0]=actual[1];
            actual[1]=temp;
        }
    }
    for (int i=0;i<n;i++)
    {
        while (supposed[i]>actual[i])
        {
            supposed[i]--;
            last++;
        }
        while (supposed[i]<actual[i])
        {
            supposed[i]++;
            last++;
        }
    }
    cout <<last;
}


#include <iostream>
using namespace std;
int main()
{
    long long int n,last=0,temp;
    int *supposed,*actual;
    cin >>n;
    supposed=new int [n];
    actual=new int [n];
    supposed[0]=1;
    for (int i=0;i<n;i++)
    {
        cin >>actual[i];
        if (i<n-1)
            supposed[i+1]=n-i;
    }
    if (n==2)
    {
        if (actual[0]>actual[1])
        {
            temp=actual[0];
            actual[0]=actual[1];
            actual[1]=temp;
        }
    }
    for (int i=0;i<n;i++)
    {
        if (supposed[i]>actual[i])
            last+=supposed[i]-actual[i];
        if (supposed[i]<actual[i])
            last+=actual[i]-supposed[i];
    }
    cout <<last;
}


#include <iostream>
#include <algorithm>
using namespace std;
int main()
{
    long long int n,a[300000],last=0;
    cin >>n;
    for (int i=0;i<n;i++)
        cin >>a[i];
    sort (a,a+n);
    for (int i=0;i<n;i++)
        last+=abs(a[i]-i-1);
    cout <<last;
}


#include <iostream>
#include <algorithm>
using namespace std;
int main()
{
    long long int n,a[100000],last=0;
    cin >>n;
    for (int i=0;i<n;i++)
        cin >>a[i];
    sort (a,a+n);
    for (int i=0;i<n;i++)
        last+=abs(a[i]-i-1);
    cout <<last;
}
//


#include<algorithm>
#include<iostream>
#include<cstdio>
using namespace std;
_int64 Count;
void main(){
int n,a[300001];
scanf("%d",&n);
for(int i=1;i<=n;i++)scanf("%d",&a[i]);
sort(a+1,a+n+1);
for(int i=1;i<=n;i++)Count+=abs(i-abs(a[i]));
printf("%I64d\n",Count);
}


#include<algorithm>
#include<iostream>
#include<cstdio>
using namespace std;
_int64 Count;
void main(){
int n,a[300001];
scanf("%d",&n);
for(int i=1;i<=n;i++)scanf("%d",&a[i]);
sort(a+1,a+n+1);
for(int i=1;i<=n;i++)Count+=abs(i-a[i]);
printf("%I64d\n",Count);
}


#include<algorithm>
#include<iostream>
#include<cstdio>
#include<vector>
using namespace std;
_int64 Count;
void main(){
vector<int>V;
int n,data;
scanf("%d",&n);
for(int i=1;i<=n;i++){
scanf("%d",&data);
V.push_back(data);}
sort(V.begin(),V.end());
for(int i=0;i<n;i++)Count+=abs(i+1-V[i]);
printf("%I64d\n",Count);
}


// IN THE NAME OF GOD

#include <iostream>
#include <vector>
#include <queue>
#include <string>
#include <algorithm>
#include <set>
#include <map>
#include <math.h>
#include <list>
#include <stack>
#include <cstdio>
#include <cmath>
#include <iomanip>

using namespace std;

typedef long long ll;

void PE(string Z)
{
	cout << Z ;
	exit(0) ;
}

#define pb push_back
#define mp make_pair
#define F first
#define S second
#define max3(AA,BB,CC) max(AA,max(BB,CC))
#define max4(AA,BB,CC,DD) max(AA,max(BB,max(CC,DD)))

const int MOD = 1e9 + 7 ;
const int MAXN= 1e5 + 22 ;

int n , a[MAXN];
ll ans ;
int main()
{
	ios_base::sync_with_stdio(false) ;
	cin >> n ;
	for(int i = 0 ; i < n ;i++)
	{
		cin >> a[i] ;
	}
	sort(a,a+n) ;
	for(int i =0 ; i < n ; i++)
		ans += abs(a[i] - (i+1)) ;
	cout << ans;
	return 0;
}


// IN THE NAME OF GOD

#include <iostream>
#include <vector>
#include <queue>
#include <string>
#include <algorithm>
#include <set>
#include <map>
#include <math.h>
#include <list>
#include <stack>
#include <cstdio>
#include <cmath>
#include <iomanip>

using namespace std;

typedef long long ll;

void PE(string Z)
{
	cout << Z ;
	exit(0) ;
}

#define pb push_back
#define mp make_pair
#define F first
#define S second
#define max3(AA,BB,CC) max(AA,max(BB,CC))
#define max4(AA,BB,CC,DD) max(AA,max(BB,max(CC,DD)))

const int MOD = 1e9 + 7 ;
const int MAXN= 1e5 + 22 ;

int n ,ans , a[MAXN];

int main()
{
	ios_base::sync_with_stdio(false) ;
	cin >> n ;
	for(int i = 0 ; i < n ;i++)
	{
		cin >> a[i] ;
	}
	sort(a,a+n) ;
	for(int i =0 ; i < n ; i++)
		ans += abs(a[i] - (i+1)) ;
	cout << ans;
	return 0;
}


// IN THE NAME OF GOD

#include <iostream>
#include <vector>
#include <queue>
#include <string>
#include <algorithm>
#include <set>
#include <map>
#include <math.h>
#include <list>
#include <stack>
#include <cstdio>
#include <cmath>
#include <iomanip>

using namespace std;

typedef long long ll;

void PE(string Z)
{
	cout << Z ;
	exit(0) ;
}

#define pb push_back
#define mp make_pair
#define F first
#define S second
#define max3(AA,BB,CC) max(AA,max(BB,CC))
#define max4(AA,BB,CC,DD) max(AA,max(BB,max(CC,DD)))

const int MOD = 1e9 + 7 ;
const int MAXN= 1e5*3 + 22 ;

int n , a[MAXN];
ll ans ;
int main()
{
	ios_base::sync_with_stdio(false) ;
	cin >> n ;
	for(int i = 0 ; i < n ;i++)
	{
		cin >> a[i] ;
	}
	sort(a,a+n) ;
	for(int i =0 ; i < n ; i++)
		ans += abs(a[i] - (i+1)) ;
	cout << ans;
	return 0;
}


# include <iostream>
# include <math.h>

using namespace std;

void selection_sort( long arr[ ], long n )
{
  int i, j, max, temp;
  for( i = n - 1 ; i > 0 ; i-- )
  {
    max = 0;
    for( j = 1 ; j <= i ; j++ )
    {
      if( arr[ max ] < arr[ j ] )
      {
        max = j;
      }
    }
    temp = arr[ i ];
    arr[ i ] = arr[ max ];
    arr[ max ] = temp;
  }
}

void main ()
{
	long n,i,*a[300000],j,ans;

	cin >> n;

	for (i=0;i<n;i++)
		cin >> *a[i];

	selection_sort (a[300000], n);

	for (i=0,ans=0;i<n;i++)
		ans+=fabs(double(*a[i]-(i+1)));

	cout << ans;
}


# include <iostream>
# include <math.h>

using namespace std;

void main ()
{
	long long n,i,a[300000],j,ans;

	cin >> n;

	for (i=0;i<n;i++)
		cin >> a[i];

	for (i=0;i<n-1;i++)
		for (j=0;j<n-1;j++)
			if (a[j+1]<a[j])
				swap (a[j+1],a[j]);

	for (i=0,ans=0;i<n;i++)
		ans+=fabs(double(a[i]-(i+1)));

	cout << ans;
}


# include <iostream>
# include <math.h>

using namespace std;

int compare (const void * a, const void * b)
{
  return ( *(long long*)a - *(long long*)b );
}

void main ()
{
	long long n,i,a[300000],j,ans;

	cin >> n;

	for (i=0;i<n;i++)
		cin >> a[i];

	qsort (a, 6, sizeof(long long), compare);

	for (i=0,ans=0;i<n;i++)
		ans+=fabs(double(a[i]-(i+1)));

	cout << ans;
}


# include <iostream>
# include <math.h>

using namespace std;

void main ()
{
	long long n,i,a[30000],j,ans;

	cin >> n;

	for (i=0;i<n;i++)
		cin >> a[i];

	for (i=0;i<n-1;i++)
		for (j=0;j<n-1;j++)
			if (a[j+1]<a[j])
				swap (a[j+1],a[j]);

	for (i=0,ans=0;i<n;i++)
		ans+=fabs(double(a[i]-i-1));

	cout << ans;
}


# include <iostream>
# include <math.h>
# include <stdlib.h>
#include <algorithm>
#include <vector>

using namespace std;

int compare (const void * a, const void * b)
{
  return ( *(int*)a - *(int*)b );
}

void main ()
{
	long long n,i,j,ans,a[300000];

	cin >> n;

	for (i=0;i<n;i++)
		cin >> a[i];

	vector<double> myvector;

	myvector.assign(a,a+n);

	stable_sort (myvector.begin(), myvector.end());

	vector<double>::iterator it=myvector.begin();

	for (i=0,ans=0;i<n;i++,it++)
		ans+=fabs(double(*it-(i+1)));

	cout << ans;
}


#include <stdio.h>
#include <string>
#include <iostream>
#include <math.h>
#include <vector>
#include <algorithm>

using namespace std;

void solve(){
	int n;
	cin >> n;
	int counter = 0;
	int num;
	vector<int> nums;
	for (int i = 1; i <= n; i++) {
		cin >> num;
		nums.push_back(num);
	}
	sort(nums.begin(), nums.end());
	for (int i = 1; i <= n; i++) {
		counter += abs(nums[i-1] - i);
	}
	cout << counter << endl;
}

int main(void) {
    solve();
    return 0;
}


#include <stdio.h>
#include <string>
#include <iostream>
#include <math.h>
#include <vector>
#include <algorithm>

using namespace std;

void solve(){
	int n;
	cin >> n;
	int sum = 0;
	int num;
	vector<int> nums;
	for (int i = 1; i <= n; i++) {
		cin >> num;
		if(num < 0) { sum -= num; num = 0; }
		else if (num > n) { sum += num - n; num = n; }
		nums.push_back(num);
	}
	sort(nums.begin(), nums.end());
	for (int i = 1; i <= n; i++) {
		if (nums[i-1] > i) sum = sum + (nums[i-1] - i);
		else sum = sum + (i - nums[i-1]);
	}
	cout << sum << endl;
}

int main(void) {
    solve();
    return 0;
}


#include <stdio.h>
#include <string>
#include <iostream>
#include <math.h>
#include <vector>
#include <algorithm>

using namespace std;

void solve(){
	int n;
	cin >> n;
	unsigned long long sum = 0;
	int num;
	vector<int> nums;
	for (int i = 1; i <= n; i++) {
		cin >> num;
		if(num < 0) { sum -= num; num = 0; }
		else if (num > n) { sum += num - n; num = n; }
		nums.push_back(num);
	}
	sort(nums.begin(), nums.end());
	for (int i = 1; i <= n; i++) {
		if (nums[i-1] > i) sum = sum + (nums[i-1] - i);
		else sum = sum + (i - nums[i-1]);
	}
	cout << sum << endl;
}

int main(void) {
    solve();
    return 0;
}


#include <iostream>
#include<algorithm>
using namespace std;
int main()
{
	int n,a[300000],i;
	int ans=0;
	cin>>n;
	for(i=0;i<n;i++)
		cin>>a[i];
	sort(a,a+n);
	for(i=1;i<=n;i++)
		ans+=abs(a[i]-i);
	cout<<ans<<endl;
	return 0;
}


#include <iostream>
#include<algorithm>
using namespace std;
int main()
{
	int n,a[300000],i;
	long long kol=0;
	cin>>n;
	for(i=0;i<n;i++)
		cin>>a[i];
	sort(a,a+n);
	for(i=1;i<n;i++)
		kol+=abs(a[i]-i);
	cout<<kol<<endl;
	return 0;
}


#include <iostream>
#include<algorithm>
using namespace std;
int main()
{
	int n,a[300000],i;
	long long kol=0;
	cin>>n;
	for(i=0;i<n;i++)
		cin>>a[i];
	sort(a,a+n);
	for(i=0;i<n;i++)
		kol+=abs(a[i]-i-1);
	cout<<kol<<endl;
	return 0;
}


#include <iostream>
#include<algorithm>
using namespace std;
int main()
{
	int n,a[300000],i;
	long long kol=0;
	cin>>n;
	for(i=1;i<=n;i++)
		cin>>a[i];
	sort(a,a+n);
	for(i=1;i<=n;i++)
		kol+=abs(a[i]-i);
	cout<<kol<<endl;
	return 0;
}


#include <iostream>
#include<algorithm>
using namespace std;
int main()
{
	int n,a[300000],i;
	int ans=0;
	cin>>n;
	for(i=0;i<n;i++)
		cin>>a[i];
	sort(a,a+n);
	for(i=0;i<n;i++)
		ans+=abs(a[i]-i-1);
	cout<<ans<<endl;
	return 0;
}


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

using namespace std;
int main()
	{
		int n,count=0;
		cin>>n;
		vector<int> vec(n);
		for(int i=0;i<n;i++)
		{
			cin>>vec[i];
		}
		if(vec[0]<=0)
		{
			count+=abs(vec[0])+1;
			vec[0]+=abs(vec[0])+1;
		}
		if(vec[0]>n){
			count+=vec[0]-n;
			vec[0]+=vec[0]-n;
		}

		for(int i=1;i<n-1;i++)
		{
			if(vec[i]<=0){
				count+=abs(vec[i])+1;
				vec[i]+=abs(vec[i])+1;
			}
			if(vec[i]>n){
				count+=vec[i]-n;
				vec[i]+=vec[i]-n;
			}
			if((vec[i-1]==vec[i]||vec[i]==vec[i+1])&&(vec[i+1]-vec[i-1]==1)){
				count+=2;
				vec[i]-=2;

			}
			if((vec[i-1]==vec[i]||vec[i]==vec[i+1])&&(vec[i+1]-vec[i-1]==(-1))){
				count+=2;
				vec[i]+=2;

			}
			if((vec[i-1]==vec[i]||vec[i]==vec[i+1])&&(vec[i+1]==vec[i-1])){
				count++;
				vec[i]++;

			}

		}
		if(vec[n-1]<=0)
		{
			count+=abs(vec[n-1])+1;
			vec[n-1]+=abs(vec[n-1])+1;
		}
		if(vec[n-1]>n){
			count+=vec[n-1]-n;
			vec[n-1]+=vec[n-1]-n;
		}

		cout<<count;

return 0;
}


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

using namespace std;
int main()
    {
		int n;
		long long count=0;
		cin>>n;

		vector<int> vec(n);
;

		for(int i=0;i<n;i++)
		{
			cin>>vec[i];
			if(vec[i]<=0){
				count+=abs(vec[i])+1;
				vec[i]+=abs(vec[i])+1;
			}
			if(vec[i]>n)
			{
				count+=vec[i]-n;
				vec[i]-=vec[i]-n;
			}

		}
		sort(vec.begin(),vec.end());
		reverse(vec.begin(),vec.end());

		for(int i=0;i<n;i++)
		{
			count+=abs((n-i)-vec[i]);
		}

		cout<<count;

return 0;
}


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

using namespace std;
int main()
	{
		int n,count=0;
		cin>>n;
		vector<int> vec(n);
		for(int i=0;i<n;i++)
		{
			cin>>vec[i];
			if(vec[i]<=0){
				count+=abs(vec[i])+1;
				vec[i]+=abs(vec[i])+1;
			}
			if(vec[i]>n)
			{
				count+=vec[i]-n;
				vec[i]-=vec[i]-n;
			}
		}

		for(int i=1;i<n-1;i++)
		{
			if((vec[i]==vec[i-1]==vec[i+1])){
				count++;
				if(vec[i]==1)
					vec[i]++;
				else if(vec[i]==n)
					vec[i]--;
				else
					vec[i]--;

			}

			else if((vec[i]==vec[i-1])&&(vec[i-1]-vec[i+1]==1))
			{

				if(vec[i]==n)
				{
					count-=2;
					vec[i]-=2;
				}
				else
					count++;
				vec[i]++;

			}

			 else if((vec[i]==vec[i-1])&&(vec[i+1]-vec[i-1]==1))
			{

				if(vec[i]==1){
					count+=2;
					vec[i]+=2;
				}
				else
					count++;
				vec[i]--;

		}

			 else if((vec[i]==vec[i+1])&&(vec[i+1]-vec[i-1]==1))
			{
				if(vec[i]==n)
				{
					count++;
					vec[i]--;
				}
				else
					count++;
				vec[i]++;
			}

			 else if((vec[i]==vec[i+1])&&(vec[i-1]-vec[i+1]==1))
			{
				if(vec[i]==1)
				{
					count+=2;
					vec[i]+=2;
				}
				else
					count++;
				vec[i]--;
			}

		}
		cout<<count;

return 0;
}


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

using namespace std;
int main()
	{
		int n,count=0;
		cin>>n;
		vector<int> vec(n);
		for(int i=0;i<n;i++)
		{
			cin>>vec[i];
		}
		if(vec[0]<=0)
		{
			count+=abs(vec[0])+1;
			vec[0]+=abs(vec[0])+1;
		}
		if(vec[0]>n){
			count+=vec[0]-n;
			vec[0]-=vec[0]-n;
		}

		for(int i=1;i<n-1;i++)
		{
			if(vec[i]<=0){
				count+=abs(vec[i])+1;
				vec[i]+=abs(vec[i])+1;
			}
			if(vec[i]>n){
				count+=vec[i]-n;
				vec[i]-=vec[i]-n;
			}
			if((vec[i-1]==vec[i]||vec[i]==vec[i+1])&&(vec[i+1]-vec[i-1]==1)){
				count++;
				vec[i]--;

			}
			if((vec[i-1]==vec[i]||vec[i]==vec[i+1])&&(vec[i+1]-vec[i-1]==(-1))){
				count++;
				vec[i]++;

			}
			if((vec[i-1]==vec[i]||vec[i]==vec[i+1])&&(vec[i+1]==vec[i-1])){
				count++;
				vec[i]++;

			}

		}
		if(vec[n-1]<=0)
		{
			count+=abs(vec[n-1])+1;
			vec[n-1]+=abs(vec[n-1])+1;
		}
		if(vec[n-1]>n){
			count+=vec[n-1]-n;
			vec[n-1]-=vec[n-1]-n;
		}

		cout<<count;

return 0;
}


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

using namespace std;
int main()
	{
		int n,count=0;
		cin>>n;
		vector<int> vec(n);
		for(int i=0;i<n;i++)
		{
			cin>>vec[i];
		}
		if(vec[0]<=0)
		{
			count+=abs(vec[0])+1;
			vec[0]+=abs(vec[0])+1;
		}
		if(vec[0]>n){
			count+=vec[0]-n;
			vec[0]-=vec[0]-n;
		}

		for(int i=1;i<n-1;i++)
		{
			if(vec[i]<=0){
				count+=abs(vec[i])+1;
				vec[i]+=abs(vec[i])+1;
			}
			if(vec[i]>n){
				count+=vec[i]-n;
				vec[i]-=vec[i]-n;
			}
			if((vec[i-1]==vec[i]||vec[i]==vec[i+1])&&(vec[i+1]-vec[i-1]==1)){
				count++;
				vec[i]--;

			}
			if((vec[i-1]==vec[i]||vec[i]==vec[i+1])&&(vec[i+1]-vec[i-1]==(-1))){
				count++;
				vec[i]++;

			}
			if((vec[i-1]==vec[i]||vec[i]==vec[i+1])&&(vec[i+1]==vec[i-1])){
				count++;
				vec[i]++;

			}

		}
		if(vec[n-1]<=0)
		{
			count+=abs(vec[n-1])+1;
			vec[n-1]+=abs(vec[n-1])+1;
		}
		if(vec[n-1]>n){
			count+=vec[n-1]-n;
			vec[n-1]-=vec[n-1]-n;
		}
		for(int i=0;i<n;i++)
			cout<<vec[i]<<" ";
		cout<<endl;

		cout<<count;

return 0;
}


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

using namespace std;
int main()
    {
		int n;
		long long count=0;
		cin>>n;

		vector<int> vec(n);
		for(int i=0;i<n;i++)
		{
			cin>>vec[i];
			if(vec[i]<=0){
				count+=abs(vec[i])+1;
				vec[i]+=abs(vec[i])+1;
			}
			if(vec[i]>n)
			{
				count+=vec[i]-n;
				vec[i]-=vec[i]-n;
			}

		}
		sort(vec.begin(),vec.end());
		reverse(vec.begin(),vec.end());

	/*	for(int i=0;i<n;i++)
		 cout<<vec[i]<<" ";
		cout<<endl;*/
		for(int i=0;i<n;i++)
		{
			count+=(n-i)-vec[i];
		}

		cout<<count;

return 0;
}


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

using namespace std;
int main()
    {
		int n,count=0;
		cin>>n;
		vector<int> vec(n);
		for(int i=0;i<n;i++)
		{
			cin>>vec[i];
			if(vec[i]<=0){
				count+=abs(vec[i])+1;
				vec[i]+=abs(vec[i])+1;
			}
			if(vec[i]>n)
			{
				count+=vec[i]-n;
				vec[i]-=vec[i]-n;
			}
		}
		for(int i = 0;i<n;i++)
			cout<<vec[i]<<" ";
		cout<<endl;
		for(int i=1;i<n-1;i++)
		{
			if(vec[1]==vec[0]&&vec[1]==vec[2]){
				count++;
				if(vec[i]==1)
					vec[i]++;
				else if(vec[i]==n)
					vec[i]--;
				else
					vec[i]--;

			}
			else if((vec[i]==vec[i-1])&&(vec[i+1]-vec[i-1]==1))
			{
				if(vec[i]==1)
				{
					count+=2;
					vec[i]+=2;
				}
				else
				{
					count++;
					vec[i]--;
				}
			}
			else if((vec[i]==vec[i-1])&&(vec[i-1]-vec[i+1]==1))
			{
				if(vec[i]==n)
				{
					count+=2;
					vec[i]-=2;
				}
				else
				{
					count++;
					vec[i]++;
				}
			}
			else if((vec[i]==vec[i-1])&&(vec[i+1]-vec[i-1]==2))
			{
				count++;
				vec[i]++;
			}
			else if((vec[i]==vec[i-1])&&(vec[i-1]-vec[i+1]==2))
			{
				count++;
				vec[i]--;
			}
			else if((vec[i]==vec[i+1])&&(vec[i-1]-vec[i+1]==1))
			{
				if(vec[i]==1)
				{
					count+=2;
					vec[i]+=2;
				}
				else
				{
					count++;
					vec[i]--;
				}
			}
			else if((vec[i]==vec[i+1])&&(vec[i+1]-vec[i-1]==1))
			{
				if(vec[i]==n)
				{
					count+=2;
					vec[i]-=2;
				}
				else
				{
					count++;
					vec[i]++;
				}
			}
			else if((vec[i]==vec[i+1])&&(vec[i+1]-vec[i-1]==2))
			{
				count++;
				vec[i]--;
			}
			else if((vec[i]==vec[i+1])&&(vec[i-1]-vec[i+1]==2))
			{
				count++;
				vec[i]++;
			}

		}
		for(int i=0;i<n;i++)
				cout<<vec[i]<<" ";
			cout<<endl;
		cout<<count;

return 0;
}


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

using namespace std;
int main()
    {
		int n,count=0;
		cin>>n;
		vector<int> vec(n);
		for(int i=0;i<n;i++)
		{
			cin>>vec[i];
			if(vec[i]<=0){
				count+=abs(vec[i])+1;
				vec[i]+=abs(vec[i])+1;
			}
			if(vec[i]>n)
			{
				count+=vec[i]-n;
				vec[i]-=vec[i]-n;
			}
		}

		for(int i=1;i<n-1;i++)
		{
			if(vec[1]==vec[0]&&vec[1]==vec[2]){
				count++;
				if(vec[i]==1)
					vec[i]++;
				else if(vec[i]==n)
					vec[i]--;
				else
					vec[i]--;

			}

			else if((vec[i]==vec[i-1])&&(vec[i+1]-vec[i-1]==1))
			{
				if(vec[i]==1)
				{
					count+=2;
					vec[i]+=2;
				}
				else
				{
					count++;
					vec[i]--;
				}
			}
			else if((vec[i]==vec[i-1])&&(vec[i-1]-vec[i+1]==1))
			{
				if(vec[i]==n)
				{
					count+=2;
					vec[i]-=2;
				}
				else
				{
					count++;
					vec[i]++;
				}
			}
			else if((vec[i]==vec[i-1])&&(vec[i+1]-vec[i-1]==2))
			{
				count++;
				vec[i]++;
			}
			else if((vec[i]==vec[i-1])&&(vec[i-1]-vec[i+1]==2))
			{
				count++;
				vec[i]--;
			}
			else if((vec[i]==vec[i+1])&&(vec[i-1]-vec[i+1]==1))
			{
				if(vec[i]==1)
				{
					count+=2;
					vec[i]+=2;
				}
				else
				{
					count++;
					vec[i]--;
				}
			}
			else if((vec[i]==vec[i+1])&&(vec[i+1]-vec[i-1]==1))
			{
				if(vec[i]==n)
				{
					count+=2;
					vec[i]-=2;
				}
				else
				{
					count++;
					vec[i]++;
				}
			}
			else if((vec[i]==vec[i+1])&&(vec[i+1]-vec[i-1]==2))
			{
				count++;
				vec[i]--;
			}
			else if((vec[i]==vec[i+1])&&(vec[i-1]-vec[i+1]==2))
			{
				count++;
				vec[i]++;
			}

		}

		cout<<count;

return 0;
}


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

using namespace std;
int main()
    {
		int n,count=0;
		cin>>n;
		vector<int> vec(n);
		for(int i=0;i<n;i++)
		{
			cin>>vec[i];
			if(vec[i]<=0){
				count+=abs(vec[i])+1;
				vec[i]+=abs(vec[i])+1;
			}
			if(vec[i]>n)
			{
				count+=vec[i]-n;
				vec[i]-=vec[i]-n;
			}
		}

		for(int i=1;i<n-1;i++)
		{
			if(vec[1]==vec[0]&&vec[1]==vec[2]){
				count++;
				if(vec[i]==1)
					vec[i]++;
				else if(vec[i]==n)
					vec[i]--;
				else
					vec[i]--;

			}
			else if((vec[i]==vec[i-1])){
			 if((vec[i+1]-vec[i-1]==1))
			{
				if(vec[i]==1)
				{
					count+=2;
					vec[i]+=2;
				}
				else
				{
					count++;
					vec[i]--;
				}
			}
			else if((vec[i-1]-vec[i+1]==1))
			{
				if(vec[i]==n)
				{
					count+=2;
					vec[i]-=2;
				}
				else
				{
					count++;
					vec[i]++;
				}
			}
			else if((vec[i+1]-vec[i-1]==2))
			{
				count++;
				vec[i]++;
			}
			else if((vec[i-1]-vec[i+1]==2))
			{
				count++;
				vec[i]--;
			}
			else
			{
				if(vec[i]==1)
				{
					count++;vec[i]++;
				}
				else
				{
					count++;vec[i]--;
				}
			}
			}
			else if((vec[i]==vec[i+1])){
			 if((vec[i-1]-vec[i+1]==1))
			{
				if(vec[i]==1)
				{
					count+=2;
					vec[i]+=2;
				}
				else
				{
					count++;
					vec[i]--;
				}
			}
			else if((vec[i+1]-vec[i-1]==1))
			{
				if(vec[i]==n)
				{
					count+=2;
					vec[i]-=2;
				}
				else
				{
					count++;
					vec[i]++;
				}
			}
			else if((vec[i+1]-vec[i-1]==2))
			{
				count++;
				vec[i]--;
			}
			else if((vec[i-1]-vec[i+1]==2))
			{
				count++;
				vec[i]++;
			}
			else
			{
				if(vec[i]==1)
				{
					count++;vec[i]++;
				}
				else
				{
					count++;vec[i]--;
				}
			}
			}

		}

		cout<<count;

return 0;
}


import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.util.StringTokenizer;

public class XeniaAndSpies {

	public static void main(String[] args) throws IOException {
		Scanner sc = new Scanner(System.in);

		int n = sc.nextInt();
		int m = sc.nextInt();
		int s = sc.nextInt();
		int f = sc.nextInt();

		int dx = f>s?1:-1;
		char c = f>s?'R':'L';
		int cur_time =1;

		StringBuilder sb = new StringBuilder();
		for(int i=0;i<m;i++ , cur_time++)
		{
			int t1 = sc.nextInt();
			int l = sc.nextInt();
			int r = sc.nextInt();

			if(s == f)
				continue;
			while(cur_time<t1 && ((dx==1 && s<f) || (dx==-1 && s>f)))
			{
				s+=dx;
				sb.append(c);
				cur_time++;
			}
			if(s == f)
				continue;

			if( (s+dx<=r && s+dx>=l) || (s<=r && s>=l) )
				sb.append('X');
			else
			{
				s+=dx;
				sb.append(c);
			}

		}
		while(s!=f)
		{
			s+=dx;
			sb.append(c);
		}

		System.out.println(sb);
	}

static class Scanner
{
	StringTokenizer st;
	BufferedReader br;

	public Scanner(InputStream s){	br = new BufferedReader(new InputStreamReader(s));}

	public String next() throws IOException
	{
		while (st == null || !st.hasMoreTokens())
			st = new StringTokenizer(br.readLine());
		return st.nextToken();
	}

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

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

	public String nextLine() throws IOException {return br.readLine();}

	public double nextDouble() throws IOException
	{
		String x = next();
		StringBuilder sb = new StringBuilder("0");
		double res = 0, f = 1;
		boolean dec = false, neg = false;
		int start = 0;
		if(x.charAt(0) == '-')
		{
			neg = true;
			start++;
		}
		for(int i = start; i < x.length(); i++)
			if(x.charAt(i) == '.')
			{
				res = Long.parseLong(sb.toString());
				sb = new StringBuilder("0");
				dec = true;
			}
			else
			{
				sb.append(x.charAt(i));
				if(dec)
					f *= 10;
			}
		res += Long.parseLong(sb.toString()) / f;
		return res * (neg?-1:1);
	}

	public boolean ready() throws IOException {return br.ready();}
}

}


import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.util.StringTokenizer;

public class XeniaAndSpies {

	public static void main(String[] args) throws IOException {
		Scanner sc = new Scanner(System.in);

		int n = sc.nextInt();
		int m = sc.nextInt();
		int s = sc.nextInt();
		int f = sc.nextInt();

		int t = 1;
		int cur = s;
		StringBuilder sb = new StringBuilder();
		for(int i=0;i<m;i++)
		{
			int t1 = sc.nextInt();
			int l = sc.nextInt();
			int r = sc.nextInt();
			if(cur ==f)
				continue;
			//System.out.println(t + "  " + t1 +" " + cur + "  " + l + "  " + r);
			if(((cur+1>=l || cur>=l)  && (cur+1<=r || cur<=r) && t1 == t && f>cur) ||
					((cur-1>=l || cur>=l)  && (cur-1<=r || cur<=r)  && t1 == t && f<cur ))
			{
				sb.append('X');
				t++;
			}
			else
				if(f>cur)
				{
					sb.append('R');
					t++;
					cur++;
				}
				else
				{
					sb.append('L');
					t++;
					cur--;
				}
		}
		System.out.println(sb);

	}

static class Scanner
{
	StringTokenizer st;
	BufferedReader br;

	public Scanner(InputStream s){	br = new BufferedReader(new InputStreamReader(s));}

	public String next() throws IOException
	{
		while (st == null || !st.hasMoreTokens())
			st = new StringTokenizer(br.readLine());
		return st.nextToken();
	}

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

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

	public String nextLine() throws IOException {return br.readLine();}

	public double nextDouble() throws IOException
	{
		String x = next();
		StringBuilder sb = new StringBuilder("0");
		double res = 0, f = 1;
		boolean dec = false, neg = false;
		int start = 0;
		if(x.charAt(0) == '-')
		{
			neg = true;
			start++;
		}
		for(int i = start; i < x.length(); i++)
			if(x.charAt(i) == '.')
			{
				res = Long.parseLong(sb.toString());
				sb = new StringBuilder("0");
				dec = true;
			}
			else
			{
				sb.append(x.charAt(i));
				if(dec)
					f *= 10;
			}
		res += Long.parseLong(sb.toString()) / f;
		return res * (neg?-1:1);
	}

	public boolean ready() throws IOException {return br.ready();}
}

}


import java.util.*;
import java.io.*;
public class a {
    static long mod = 1000000007;
    public static void main(String[] args) throws IOException {
        // Scanner input = new Scanner(new File("input.txt"));
        // PrintWriter out = new PrintWriter(new File("output.txt"));
        input.init(System.in);
        PrintWriter out = new PrintWriter((System.out));

        int n = input.nextInt(), m = input.nextInt(), s = input.nextInt(), f = input.nextInt();
        int[] ts = new int[m], ls = new int[m], rs = new int[m];
        for(int i = 0; i<m; i++)
        {
            ts[i] = input.nextInt(); ls[i] = input.nextInt(); rs[i] = input.nextInt();
        }
        ArrayList<Character> list = new ArrayList<Character>();
        int at = s, ati = 0;
        int t = 1;
        while(at!= f)
        {
            int to = f > at ? at+1 : at-1;
            if(ati < m && t == ts[ati])
            {
                if(at >= ls[ati] && at <= rs[ati] || to >= ls[ati] && to <= rs[ati])
                {
                    list.add('X');
                }
                else
                {

                    if(to > at)
                    {
                        list.add('R');
                    }
                    else
                    {
                        list.add('L');
                    } at = to;
                }
                ati++;
            }
            else
            {
                if(to > at)
                {
                    list.add('R');
                }
                else
                {
                    list.add('L');
                } at = to;
            }
            t++;
        }
        for(char c: list) out.print(c);
        out.close();
    }
    static long pow(long x, long p) {
        if (p == 0)
            return 1;
        if ((p & 1) > 0) {
            return (x * pow(x, p - 1)) % mod;
        }
        long sqrt = pow(x, p / 2);
        return (sqrt * sqrt) % mod;
    }

    static class input {
        static BufferedReader reader;
        static StringTokenizer tokenizer;

        /** call this method to initialize reader for InputStream */
        static void init(InputStream input) {
            reader = new BufferedReader(new InputStreamReader(input));
            tokenizer = new StringTokenizer("");
        }

        /** get next word */
        static String next() throws IOException {
            while (!tokenizer.hasMoreTokens()) {
                // TODO add check for eof if necessary
                tokenizer = new StringTokenizer(reader.readLine());
            }
            return tokenizer.nextToken();
        }

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

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

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

        static String nextLine() throws IOException {
            return reader.readLine();
        }
    }
    public static boolean[] sieve(int n)
    {
        boolean[] res = new boolean[n+1];
        for(int i = 2; i<=n; i++) res[i] = true;
        for(int i = 2; i <= Math.sqrt(n); i++)
            if(res[i])
                for(long j = (long)i*i; j<=n; j+=i)
                    res[(int) j] = false;
        return res;
    }
    //GCD - O(log(max(p, q)))
    //res[0] is gcd of p and q
    //res[1] and res[2] are values used in extended Euclidean algorithm for inverse mod
    public static long[] gcd(long p, long q)
    {
        if(q==0)
            return new long[] {p, 1, 0};
        long[] vals = gcd(q, p%q);
        return new long[] {vals[0], vals[2], vals[1] - (p/q)*vals[2]};
    }
    //Inverse Mod - O(log(mod))
    //Returns A s.t. x*A = 1(MOD mod)
    public static long invmod(long x)
    {
        long[] vals = gcd(x, mod);
        if(vals[0]>1)
            return -1;
        if(vals[1]>0)
            return vals[1];
        return mod + vals[1];
    }
}


import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.Map;
import java.util.Scanner;
import java.util.HashMap;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        Scanner in = new Scanner(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        CF_342B solver = new CF_342B();
        solver.solve(1, in, out);
        out.close();
    }

    static class CF_342B {
        public void solve(int testNumber, Scanner input, PrintWriter out) {
            ShortScanner in = new ShortScanner(input);
            int n = in.i(), m = in.i(), s = in.i(), f = in.i();
            Map<Integer, Pair> map = new HashMap<>();
            for (int i = 0; i < m; ++i) map.put(in.i(), new Pair(in.i(), in.i()));

            int step = 1, cur = s;
            while (true) {
                if (cur == f) break;
                boolean ok = true;
                if (map.containsKey(step)) {
                    Pair p = map.get(step);
                    if (p.a <= cur && cur <= p.b) ok = false;
                    if (p.a <= cur + 1 && cur + 1 <= p.b) ok = false;
                }
                if (ok) {
                    out.print('R');
                    cur++;
                }
                else
                    out.print('X');
                step++;
            }
            out.println();
        }

        class ShortScanner {
            Scanner in;

            ShortScanner(Scanner in) {
                this.in = in;
            }

            int i() {
                return in.nextInt();
            }

        }

        class Pair {
            int a;
            int b;

            public Pair(int a, int b) {
                this.a = a;
                this.b = b;
            }

            public boolean equals(Object o) {
                if (this == o) return true;
                if (o == null || getClass() != o.getClass()) return false;

                Pair pair = (Pair) o;

                if (a != pair.a) return false;
                return b == pair.b;

            }

            public int hashCode() {
                int result = a;
                result = 31 * result + b;
                return result;
            }

        }

    }
}


import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.Map;
import java.util.Scanner;
import java.util.HashMap;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        Scanner in = new Scanner(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        CF_342B solver = new CF_342B();
        solver.solve(1, in, out);
        out.close();
    }

    static class CF_342B {
        public void solve(int testNumber, Scanner input, PrintWriter out) {
            ShortScanner in = new ShortScanner(input);
            int n = in.i(), m = in.i(), s = in.i(), f = in.i();
            Map<Integer, Pair> map = new HashMap<>();
            for (int i = 0; i < m; ++i) map.put(in.i(), new Pair(in.i(), in.i()));

            int step = 1, cur = s;
            while (true) {
                if (cur == f) break;
                boolean ok = true;
                if (map.containsKey(step)) {
                    Pair p = map.get(step);
                    if (p.a <= cur && cur <= p.b) ok = false;
                    if (f > s && p.a <= cur + 1 && cur + 1 <= p.b) ok = false;
                    if (f < s && p.a <= cur - 1 && cur - 1 <= p.b) ok = false;
                }
                if (ok) {
                    if (f > s) {
                        out.print('R');
                        cur++;
                    }
                    else {
                        out.print('L');
                        cur--;
                    }
                }
                else
                    out.print('X');
                step++;
            }
            out.println();
        }

        class ShortScanner {
            Scanner in;

            ShortScanner(Scanner in) {
                this.in = in;
            }

            int i() {
                return in.nextInt();
            }

        }

        class Pair {
            int a;
            int b;

            public Pair(int a, int b) {
                this.a = a;
                this.b = b;
            }

            public boolean equals(Object o) {
                if (this == o) return true;
                if (o == null || getClass() != o.getClass()) return false;

                Pair pair = (Pair) o;

                if (a != pair.a) return false;
                return b == pair.b;

            }

            public int hashCode() {
                int result = a;
                result = 31 * result + b;
                return result;
            }

        }

    }
}


/**
 * Created by Omar on 2/22/2016.
 */

import java.util.*;
import java.io.*;

public class Xenia {
    public static void main(String[] args) throws Exception {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        PrintWriter pw = new PrintWriter(System.out);
        //int n=Integer.parseInt(br.readLine());
        String[] parts=br.readLine().split(" ");
        //int[]a= new int[n];
        //for(int i=0;i<n;i++){a[i]=Integer.parseInt(parts[i]);}

        //n, m, s and f

        int n=Integer.parseInt(parts[0]);
        int m=Integer.parseInt(parts[1]);

        int s=Integer.parseInt(parts[2]);
        int f=Integer.parseInt(parts[3]);

        int t;
        int l,r;
      //  l= new int[(int)1e9+1];
      //  r= new int[(int)1e9+1];
HashSet<Integer> watching= new HashSet<Integer>();
HashMap<Integer,Pair> eyes= new HashMap<Integer,Pair>();

        for(int i=1;i<=m;i++){
            parts=br.readLine().split(" ");

             t=Integer.parseInt(parts[0]);
            watching.add(t);
             l=Integer.parseInt(parts[1]);
             r=Integer.parseInt(parts[2]);
            eyes.put(t,new Pair(l,r));

        }
int L,R;
        boolean pass;
for(int i=1;i<=(int)1e9+1;i++){
    if(watching.contains(i)) {
        L=eyes.get(i).l;
        R=eyes.get(i).r;
        if (L <= s && s <= R) {
            pw.print("X");
        } else if (s > f) {
            if (L <= s - 1 && s - 1 <= R) {
                pw.print("X");
            } else {
                pw.print("L");
                s--;
            }
        } else if (s < f) {
            if (L <= s + 1 && s + 1 <= R) {
                pw.print("X");
            } else {
                pw.print("R");
                s++;
            }
        } else {
            pw.print("\n");
            pw.close();
            return;
        }

    }
    else{
        if (s > f) {
                pw.print("L");
                s--;

        } else if (s < f) {

                pw.print("R");
                s++;

        } else {
            pw.print("\n");
            pw.close();
            return;
        }
    }

}

        pw.close();
        br.close();
    }
    static class Pair implements Comparable<Pair>{
        int l,r;
        Pair(int l, int r){
            this.l=l; this.r=r;
        }
        public String toString(){
            return l+" "+r;
        }
        public int hashCode(){
            return (int)(l^ r);
        }
        public boolean equals(Object arg0){
            Pair p = (Pair)arg0;
            return (l == p.l && r == p.r);
        }
        @Override
        public int compareTo(Pair o) {
            if (l==o.l)
                return Integer.compare(r, o.r);
            return Integer.compare(l, o.l);
        }
    }

}


/**
 * Created by Omar on 2/22/2016.
 */

import java.util.*;
import java.io.*;

public class Xenia {
    public static void main(String[] args) throws Exception {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        PrintWriter pw = new PrintWriter(System.out);
        //int n=Integer.parseInt(br.readLine());
        String[] parts=br.readLine().split(" ");
        //int[]a= new int[n];
        //for(int i=0;i<n;i++){a[i]=Integer.parseInt(parts[i]);}

        //n, m, s and f

        int n=Integer.parseInt(parts[0]);
        int m=Integer.parseInt(parts[1]);

        int s=Integer.parseInt(parts[2]);
        int f=Integer.parseInt(parts[3]);

        int t;
        int l,r;
      //  l= new int[(int)1e9+1];
      //  r= new int[(int)1e9+1];
HashSet<Integer> watching= new HashSet<Integer>();
HashMap<Integer,Pair> eyes= new HashMap<Integer,Pair>();

        for(int i=1;i<=m;i++){
            parts=br.readLine().split(" ");

             t=Integer.parseInt(parts[0]);
            watching.add(t);
             l=Integer.parseInt(parts[1]);
             r=Integer.parseInt(parts[2]);
            eyes.put(t,new Pair(l,r));

        }
int L,R;
        boolean pass;
for(int i=1;i<=(int)1e9+1;i++){
    if(watching.contains(i)) {
        L=eyes.get(i).l;
        R=eyes.get(i).r;
        if (L <= s && s <= R) {
            pw.print("X");
        } else if (s > f) {
            if (L <= s - 1 && s - 1 <= R) {
                pw.print("X");
            } else {
                pw.print("L");
                s--;

            }
        } else if (s < f) {
            if (L <= s + 1 && s + 1 <= R) {
                pw.print("X");
            } else {
                pw.print("R");
                s++;
            }
        }
        if(s==f) {
            pw.print("\n");
            pw.close();
            return;
        }

    }
    else{
        if (s > f) {
                pw.print("L");
                s--;

        } else if (s < f) {

                pw.print("R");
                s++;

        } if(s==f) {
            pw.print("\n");
            pw.close();
            return;
        }
    }

}

        pw.close();
        br.close();
    }
    static class Pair implements Comparable<Pair>{
        int l,r;
        Pair(int l, int r){
            this.l=l; this.r=r;
        }
        public String toString(){
            return l+" "+r;
        }
        public int hashCode(){
            return (int)(l^ r);
        }
        public boolean equals(Object arg0){
            Pair p = (Pair)arg0;
            return (l == p.l && r == p.r);
        }
        @Override
        public int compareTo(Pair o) {
            if (l==o.l)
                return Integer.compare(r, o.r);
            return Integer.compare(l, o.l);
        }
    }

}


import java.io.*;
import java.util.*;
public class XeniaAndSpies
{
	public static void main(String args[])
	{
		Scanner scn = new Scanner(System.in);
		int n = scn.nextInt();
		int m = scn.nextInt();
		int s = scn.nextInt();
		int f = scn.nextInt();
		int i,j,time = 1;
		int arr[][] = new int[m][3];
		StringBuilder sb = new StringBuilder();
		for(i = 0;i < m; ++i)
		{
			for(j = 0;j < 3; ++j)
			{
				arr[i][j] = scn.nextInt();
			}
		}
		i = 0;j = 0;
		PrintWriter pw = new PrintWriter(System.out);
		if(s < f)
		{
			while(s < f && i < m)
			{
				if(time == arr[i][0] && ((arr[i][1] == s || arr[i][1] == (s + 1)) || (arr[i][2] == (s + 1) || arr[i][2] == s)))
				{
					sb.append('X');
					i++;
				}
				else
				{
					sb.append('R');
					s++;
					if(time == arr[i][0])
						i++;
				}
				time++;
			}
			while(s != f)
			{
				sb.append('R');
				s++;
			}
		}
		else if(s > f)
		{
			while(s > f && i < m)
			{
				if(time == arr[i][0] && ((arr[i][1] == (s - 1) || arr[i][1] == s) || (arr[i][2] == s || arr[i][2] == s - 1)))
				{
					sb.append('X');
					i++;
				}
				else
				{
					sb.append('L');
					s--;
					if(time == arr[i][0])
						i++;
				}
				time++;
			}
			while(s != f)
			{
				sb.append('L');
				s--;
			}
		}
		pw.println(sb);
		pw.close();
		scn.close();
	}
}


import java.io.*;
import java.util.*;
public class XeniaAndSpies
{
	public static void main(String args[])
	{
		Scanner scn = new Scanner(System.in);
		int n = scn.nextInt();
		int m = scn.nextInt();
		int s = scn.nextInt();
		int f = scn.nextInt();
		int i,j,time = 1;
		int arr[][] = new int[m][3];
		StringBuilder sb = new StringBuilder();
		for(i = 0;i < m; ++i)
		{
			for(j = 0;j < 3; ++j)
			{
				arr[i][j] = scn.nextInt();
			}
		}
		i = 0;j = 0;
		if(s < f)
		{
			while(s < f && i < m)
			{
				if(time == arr[i][0] && (arr[i][1] == s || arr[i][2] == s) || (arr[i][1] == (s + 1) || arr[i][2] == (s + 1)))
				{
					sb.append('X');
					i++;
				}
				else
				{
					sb.append('R');
					s++;
				}
				time++;
			}
		}
		else if(s > f)
		{
			while(s > f && i < m)
			{
				if(time == arr[i][0] && (arr[i][1] == s || arr[i][2] == s) || (arr[i][1] == (s - 1) || arr[i][2] == (s - 1)))
				{
					sb.append('X');
					i++;
				}
				else
				{
					sb.append('L');
					s--;
				}
				time++;
			}
		}
		PrintWriter pw = new PrintWriter(System.out);
		pw.println(sb);
		pw.close();
		scn.close();
	}
}


import java.io.*;
import java.util.*;
public class XeniaAndSpies
{
	public static void main(String args[])
	{
		Scanner scn = new Scanner(System.in);
		int n = scn.nextInt();
		int m = scn.nextInt();
		int s = scn.nextInt();
		int f = scn.nextInt();
		int i,j,time = 1;
		int arr[][] = new int[m][3];
		StringBuilder sb = new StringBuilder();
		for(i = 0;i < m; ++i)
		{
			for(j = 0;j < 3; ++j)
			{
				arr[i][j] = scn.nextInt();
			}
		}
		i = 0;j = 0;
		if(s < f)
		{
			while(s < f && i < m)
			{
				if(time == arr[i][0] && (arr[i][1] == s || arr[i][2] == s) || (arr[i][1] == (s + 1) || arr[i][2] == (s + 1)))
				{
					sb.append('X');
				}
				else
				{
					sb.append('R');
					s++;
				}
				i++;
				time++;
			}
		}
		else if(s > f)
		{
			while(s > f && i < m)
			{
				if(time == arr[i][0] && (arr[i][1] == s || arr[i][2] == s) || (arr[i][1] == (s - 1) || arr[i][2] == (s - 1)))
				{
					sb.append('X');
				}
				else
				{
					sb.append('L');
					s--;
				}
				i++;
				time++;
			}
		}
		PrintWriter pw = new PrintWriter(System.out);
		pw.println(sb);
		pw.close();
		scn.close();
	}
}


import java.io.*;
import java.util.*;
public class XeniaAndSpies
{
	public static void main(String args[])
	{
		Scanner scn = new Scanner(System.in);
		int n = scn.nextInt();
		int m = scn.nextInt();
		int s = scn.nextInt();
		int f = scn.nextInt();
		int i,j,time = 1;
		int arr[][] = new int[m][3];
		StringBuilder sb = new StringBuilder();
		for(i = 0;i < m; ++i)
		{
			for(j = 0;j < 3; ++j)
			{
				arr[i][j] = scn.nextInt();
			}
		}
		i = 0;j = 0;
		if(s < f)
		{
			while(s < f && i < m)
			{
				if(time == arr[i][0] && (arr[i][1] == s || arr[i][2] == s) || (arr[i][1] == (s + 1) || arr[i][2] == (s + 1)))
				{
					sb.append('X');
					i++;
				}
				else
				{
					sb.append('R');
					s++;
				}
				i++;
				time++;
			}
		}
		else if(s > f)
		{
			while(s > f && i < m)
			{
				if(time == arr[i][0] && (arr[i][1] == s || arr[i][2] == s) || (arr[i][1] == (s - 1) || arr[i][2] == (s - 1)))
				{
					sb.append('X');
					i++;
				}
				else
				{
					sb.append('L');
					s--;
				}
				time++;
			}
		}
		PrintWriter pw = new PrintWriter(System.out);
		pw.println(sb);
		pw.close();
		scn.close();
	}
}


import java.io.*;
import java.util.*;
public class XeniaAndSpies
{
	public static void main(String args[])
	{
		Scanner scn = new Scanner(System.in);
		int n = scn.nextInt();
		int m = scn.nextInt();
		int s = scn.nextInt();
		int f = scn.nextInt();
		int i,j,time = 1;
		int arr[][] = new int[m][3];
		StringBuilder sb = new StringBuilder();
		for(i = 0;i < m; ++i)
		{
			for(j = 0;j < 3; ++j)
			{
				arr[i][j] = scn.nextInt();
			}
		}
		i = 0;j = 0;
		PrintWriter pw = new PrintWriter(System.out);
		if(s < f)
		{
			while(s < f && i < m)
			{
				if(time == arr[i][0])
				{
					if((s >= arr[i][1] && s <= arr[i][2]) || ((s + 1) >= arr[i][1] && (s + 1) <= arr[i][2]))
					{
						sb.append('X');
					}
					else
					{
						sb.append('R');
						s++;
					}
					i++;
				}
				else
				{
					sb.append('R');
				}
				time++;
			}
		}
		else if(s > f)
		{
			while(s > f && i < m)
			{
				if(time == arr[i][0])
				{
					if((s >= arr[i][1] && s <= arr[i][2]) || ((s - 1) >= arr[i][1] && (s - 1) <= arr[i][2]))
					{
						sb.append('X');
					}
					else
					{
						sb.append('L');
						s--;
					}
					i++;
				}
				else
				{
					sb.append('L');
					s--;
				}
				time++;
			}
		}
		pw.println(sb);
		pw.close();
		scn.close();
	}
}


import java.io.*;
import java.util.*;
public class XeniaAndSpies
{
	public static void main(String args[])
	{
		Scanner scn = new Scanner(System.in);
		int n = scn.nextInt();
		int m = scn.nextInt();
		int s = scn.nextInt();
		int f = scn.nextInt();
		int i,j,time = 1;
		int arr[][] = new int[m][3];
		StringBuilder sb = new StringBuilder();
		for(i = 0;i < m; ++i)
		{
			for(j = 0;j < 3; ++j)
			{
				arr[i][j] = scn.nextInt();
			}
		}
		i = 0;j = 0;
		PrintWriter pw = new PrintWriter(System.out);
		if(s < f)
		{
			while(s < f && i < m)
			{
				if(time == arr[i][0] && ((arr[i][1] == s || arr[i][2] == s) || (arr[i][1] == (s + 1) || arr[i][2] == (s + 1))))
				{
					sb.append('X');
					i++;
				}
				else
				{
					sb.append('R');
					s++;
				}
				time++;
			}
		}
		else if(s > f)
		{
			while(s > f && i < m)
			{
				if(time == arr[i][0] && ((arr[i][1] == s || arr[i][2] == s) || (arr[i][1] == (s - 1) || arr[i][2] == (s - 1))))
				{
					sb.append('X');
					i++;
				}
				else
				{
					sb.append('L');
					s--;
				}
				time++;
			}
		}
		pw.println(sb);
		pw.close();
		scn.close();
	}
}


import java.io.*;
import java.util.*;
public class XeniaAndSpies
{
	public static void main(String args[])
	{
		Scanner scn = new Scanner(System.in);
		int n = scn.nextInt();
		int m = scn.nextInt();
		int s = scn.nextInt();
		int f = scn.nextInt();
		int i,j,time = 1;
		int arr[][] = new int[m][3];
		StringBuilder sb = new StringBuilder();
		for(i = 0;i < m; ++i)
		{
			for(j = 0;j < 3; ++j)
			{
				arr[i][j] = scn.nextInt();
			}
		}
		i = 0;j = 0;
		PrintWriter pw = new PrintWriter(System.out);
		if(s < f)
		{
			while(s < f && i < m)
			{
				if(time == arr[i][0])
				{
					if((s >= arr[i][1] && s <= arr[i][2]) || ((s + 1) >= arr[i][1] && (s + 1) <= arr[i][2]))
					{
						sb.append('X');
					}
					else
					{
						sb.append('R');
						s++;
					}
					i++;
				}
				else
				{
					sb.append('R');
					s++;
				}
				time++;
			}
			while(s != f)
			{
				sb.append('R');
				s++;
			}
		}
		else if(s > f)
		{
			while(s > f && i < m)
			{
				if(time == arr[i][0])
				{
					if((s >= arr[i][1] && s <= arr[i][2]) || ((s - 1) >= arr[i][1] && (s - 1) <= arr[i][2]))
					{
						sb.append('X');
					}
					else
					{
						sb.append('L');
						s--;
					}
					i++;
				}
				else
				{
					sb.append('L');
					s--;
				}
				time++;
			}
			while(s != f)
			{
				sb.append('L');
				s--;
			}
		}
		pw.println(sb);
		pw.close();
		scn.close();
	}
}


import java.io.*;
import java.util.*;
public class XeniaAndSpies
{
	public static void main(String args[])
	{
		Scanner scn = new Scanner(System.in);
		int n = scn.nextInt();
		int m = scn.nextInt();
		int s = scn.nextInt();
		int f = scn.nextInt();
		int i,j,time = 1;
		int arr[][] = new int[m][3];
		StringBuilder sb = new StringBuilder();
		for(i = 0;i < m; ++i)
		{
			for(j = 0;j < 3; ++j)
			{
				arr[i][j] = scn.nextInt();
			}
		}
		i = 0;j = 0;
		PrintWriter pw = new PrintWriter(System.out);
		if(s < f)
		{
			while(s < f && i < m)
			{
				if(time == arr[i][0])
				{
					if((s >= arr[i][1] && s <= arr[i][2]) || ((s + 1) >= arr[i][1] && (s + 1) <= arr[i][2]))
					{
						sb.append('X');
					}
					else
					{
						sb.append('R');
						s++;
					}
					i++;
				}
				else
				{
					sb.append('R');
					s++;
				}
				time++;
			}
		}
		else if(s > f)
		{
			while(s > f && i < m)
			{
				if(time == arr[i][0])
				{
					if((s >= arr[i][1] && s <= arr[i][2]) || ((s - 1) >= arr[i][1] && (s - 1) <= arr[i][2]))
					{
						sb.append('X');
					}
					else
					{
						sb.append('L');
						s--;
					}
					i++;
				}
				else
				{
					sb.append('L');
					s--;
				}
				time++;
			}
		}
		pw.println(sb);
		pw.close();
		scn.close();
	}
}


import java.io.*;
import java.util.*;
public class XeniaAndSpies
{
	public static void main(String args[])
	{
		Scanner scn = new Scanner(System.in);
		int n = scn.nextInt();
		int m = scn.nextInt();
		int s = scn.nextInt();
		int f = scn.nextInt();
		int i,j,time = 1;
		int arr[][] = new int[m][3];
		StringBuilder sb = new StringBuilder();
		for(i = 0;i < m; ++i)
		{
			for(j = 0;j < 3; ++j)
			{
				arr[i][j] = scn.nextInt();
			}
		}
		i = 0;j = 0;
		PrintWriter pw = new PrintWriter(System.out);
		if(s < f)
		{
			while(s < f && i < m)
			{
				if(time == arr[i][0])
				{
					if((s >= arr[i][1] && s <= arr[i][2]) || ((s + 1) >= arr[i][1] && (s + 1) <= arr[i][2]))
					{
						sb.append('X');
					}
					else
					{
						sb.append('R');
						s++;
					}
					i++;
				}
				else
				{
					sb.append('R');
					s++;
				}
				time++;
			}
			while(s != f)
			{
				sb.append('R');
				s++;
			}
		}
		else if(s > f)
		{
			while(s > f && i < m)
			{
				if(time == arr[i][0])
				{
					if((s >= arr[i][1] && s <= arr[i][2]) || ((s - 1) >= arr[i][1] && (s - 1) <= arr[i][2]))
					{
						sb.append('X');
					}
					else
					{
						sb.append('L');
						s--;
					}
					i++;
				}
				else
				{
					sb.append('L');
					s--;
				}
				time++;
			}
			while(s != f)
			{
				sb.append('L');
				s--;
			}
		}
		pw.println(s);
		pw.println(sb);
		pw.close();
		scn.close();
	}
}


import java.io.*;
import java.util.*;
public class XeniaAndSpies
{
	public static void main(String args[])
	{
		Scanner scn = new Scanner(System.in);
		int n = scn.nextInt();
		int m = scn.nextInt();
		int s = scn.nextInt();
		int f = scn.nextInt();
		int i,j,time = 1;
		int arr[][] = new int[m][3];
		StringBuilder sb = new StringBuilder();
		for(i = 0;i < m; ++i)
		{
			for(j = 0;j < 3; ++j)
			{
				arr[i][j] = scn.nextInt();
			}
		}
		i = 0;j = 0;
		PrintWriter pw = new PrintWriter(System.out);
		if(s < f)
		{
			while(s < f && i < m)
			{
				if(time == arr[i][0] && ((arr[i][1] == s || arr[i][1] == (s + 1)) || (arr[i][2] == (s + 1) || arr[i][2] == s)))
				{
					sb.append('X');
					i++;
				}
				else
				{
					sb.append('R');
					s++;
					if(time == arr[i][0])
						i++;
				}
				time++;
			}
		}
		else if(s > f)
		{
			while(s > f && i < m)
			{
				if(time == arr[i][0] && ((arr[i][1] == (s - 1) || arr[i][1] == s) || (arr[i][2] == s || arr[i][2] == s - 1)))
				{
					sb.append('X');
					i++;
				}
				else
				{
					sb.append('L');
					s--;
					if(time == arr[i][0])
						i++;
				}
				time++;
			}
		}
		pw.println(sb);
		pw.close();
		scn.close();
	}
}


import java.io.*;
import java.util.*;
public class XeniaAndSpies
{
	public static void main(String args[])
	{
		Scanner scn = new Scanner(System.in);
		int n = scn.nextInt();
		int m = scn.nextInt();
		int s = scn.nextInt();
		int f = scn.nextInt();
		int i,j,time = 1;
		int arr[][] = new int[m][3];
		StringBuilder sb = new StringBuilder();
		for(i = 0;i < m; ++i)
		{
			for(j = 0;j < 3; ++j)
			{
				arr[i][j] = scn.nextInt();
			}
		}
		i = 0;j = 0;
		if(s < f)
		{
			while(s < f)
			{
				if(time == arr[i][0] && (arr[i][1] == s || arr[i][2] == s) || (arr[i][1] == (s + 1) || arr[i][2] == (s + 1)))
				{
					sb.append('X');
				}
				else
				{
					sb.append('R');
					s++;
				}
				i++;
				time++;
			}
		}
		else if(s > f)
		{
			while(s > f)
			{
				if(time == arr[i][0] && (arr[i][1] == s || arr[i][2] == s) || (arr[i][1] == (s - 1) || arr[i][2] == (s - 1)))
				{
					sb.append('X');
				}
				else
				{
					sb.append('L');
					s--;
				}
				i++;
				time++;
			}
		}
		PrintWriter pw = new PrintWriter(System.out);
		pw.println(sb);
		pw.close();
		scn.close();
	}
}


import java.io.DataInputStream;
import java.io.IOException;
import java.util.Arrays;
import java.util.HashMap;
import java.util.Map;

public class A {
    public static void main(String[] args) throws IOException{
        FastReader reader = new FastReader();

        int n = reader.nextInt();
        int m = reader.nextInt();
        int s = reader.nextInt();
        int f = reader.nextInt();

        Map<Integer, int[]> sled = new HashMap<>();

        for(int i = 0; i < m; i++) {
            int t = reader.nextInt();
            int[] leftRight = new int[2];
            leftRight[0] = reader.nextInt();
            leftRight[1] = reader.nextInt();

            sled.put(t, leftRight);
        }

        int cur = s;
        int step = 1;
        while(cur != f) {
            int[] borders = sled.get(step);
            if(cur < f) {
                if( borders != null &&
                        (cur >= borders[0] && cur <= borders[1]
                        || cur + 1 >= borders[0] && cur + 1 <= borders[1])) {
                    System.out.print('X');
                } else {
                    cur++;
                    System.out.print('R');
                }
            }
            else {
                if(borders != null &&
                        (cur >= borders[0] && cur <= borders[1]
                        || cur - 1 >= borders[0] && cur - 1 <= borders[1])) {
                    System.out.print('X');
                } else {
                    cur--;
                    System.out.print('L');
                }
            }
            step++;
        }

    }

    private static class FastReader
    {
        final private int BUFFER_SIZE = 1 << 16;
        private DataInputStream din;
        private byte[] buffer;
        private int bufferPointer, bytesRead;

        public FastReader()
        {
            din = new DataInputStream(System.in);
            buffer = new byte[BUFFER_SIZE];
            bufferPointer = bytesRead = 0;
        }

        public String readLine() throws IOException
        {
            byte[] buf = new byte[64]; // line length
            int cnt = 0, c;
            while ((c = read()) != -1)
            {
                if (c == '\n')
                    break;
                buf[cnt++] = (byte) c;
            }
            return new String(buf, 0, cnt);
        }

        public int nextInt() throws IOException
        {
            int ret = 0;
            byte c = read();
            while (c <= ' ')
                c = read();
            boolean neg = (c == '-');
            if (neg)
                c = read();
            do
            {
                ret = ret * 10 + c - '0';
            }  while ((c = read()) >= '0' && c <= '9');

            if (neg)
                return -ret;
            return ret;
        }

        public long nextLong() throws IOException
        {
            long ret = 0;
            byte c = read();
            while (c <= ' ')
                c = read();
            boolean neg = (c == '-');
            if (neg)
                c = read();
            do {
                ret = ret * 10 + c - '0';
            }
            while ((c = read()) >= '0' && c <= '9');
            if (neg)
                return -ret;
            return ret;
        }

        public double nextDouble() throws IOException
        {
            double ret = 0, div = 1;
            byte c = read();
            while (c <= ' ')
                c = read();
            boolean neg = (c == '-');
            if (neg)
                c = read();

            do {
                ret = ret * 10 + c - '0';
            }
            while ((c = read()) >= '0' && c <= '9');

            if (c == '.')
            {
                while ((c = read()) >= '0' && c <= '9')
                {
                    ret += (c - '0') / (div *= 10);
                }
            }

            if (neg)
                return -ret;
            return ret;
        }

        private void fillBuffer() throws IOException
        {
            bytesRead = din.read(buffer, bufferPointer = 0, BUFFER_SIZE);
            if (bytesRead == -1)
                buffer[0] = -1;
        }

        private byte read() throws IOException
        {
            if (bufferPointer == bytesRead)
                fillBuffer();
            return buffer[bufferPointer++];
        }

        public void close() throws IOException
        {
            if (din == null)
                return;
            din.close();
        }
    }
}

/* Mon Aug 12 2019 14:20:38 GMT+0300 (MSK) */


import java.io.DataInputStream;
import java.io.IOException;
import java.util.*;
import java.util.stream.Collectors;

public class B {
    public static void main(String[] args) throws IOException{
        FastReader reader = new FastReader();

        int m = reader.nextInt();
        List<Integer> list = new ArrayList<>();
        Map<Integer, Integer> map = new HashMap<>();

        for(int i = 0; i < m; i++) {
            int cur = reader.nextInt();
            list.add(cur);
            map.put(cur, map.getOrDefault(cur, 0) + 1);
        }

        list = list.stream()
                .distinct()
                .sorted()
                .collect(Collectors.toList());

        List<Integer> res = new ArrayList<>();
        for(int i = 0; i < list.size(); i++) {
            int cur = list.get(i);
            int kol = map.get(cur);
            if(kol > 0) {
                res.add(cur);
                map.put(cur, kol - 1);
            }
        }

        for(int i = list.size() - 1; i >= 0; i--) {
            int cur = list.get(i);
            if(res.get(res.size() - 1) == cur) {
                continue;
            }
            int kol = map.get(cur);
            if(kol > 0) {
                res.add(cur);
                map.put(cur, kol - 1);
            }
        }

        System.out.println(res.size());
        for(int cur : res) {
            System.out.print(cur + " ");
        }
    }

    private static class FastReader
    {
        final private int BUFFER_SIZE = 1 << 16;
        private DataInputStream din;
        private byte[] buffer;
        private int bufferPointer, bytesRead;

        public FastReader()
        {
            din = new DataInputStream(System.in);
            buffer = new byte[BUFFER_SIZE];
            bufferPointer = bytesRead = 0;
        }

        public String readLine() throws IOException
        {
            byte[] buf = new byte[64]; // line length
            int cnt = 0, c;
            while ((c = read()) != -1)
            {
                if (c == '\n')
                    break;
                buf[cnt++] = (byte) c;
            }
            return new String(buf, 0, cnt);
        }

        public int nextInt() throws IOException
        {
            int ret = 0;
            byte c = read();
            while (c <= ' ')
                c = read();
            boolean neg = (c == '-');
            if (neg)
                c = read();
            do
            {
                ret = ret * 10 + c - '0';
            }  while ((c = read()) >= '0' && c <= '9');

            if (neg)
                return -ret;
            return ret;
        }

        public long nextLong() throws IOException
        {
            long ret = 0;
            byte c = read();
            while (c <= ' ')
                c = read();
            boolean neg = (c == '-');
            if (neg)
                c = read();
            do {
                ret = ret * 10 + c - '0';
            }
            while ((c = read()) >= '0' && c <= '9');
            if (neg)
                return -ret;
            return ret;
        }

        public double nextDouble() throws IOException
        {
            double ret = 0, div = 1;
            byte c = read();
            while (c <= ' ')
                c = read();
            boolean neg = (c == '-');
            if (neg)
                c = read();

            do {
                ret = ret * 10 + c - '0';
            }
            while ((c = read()) >= '0' && c <= '9');

            if (c == '.')
            {
                while ((c = read()) >= '0' && c <= '9')
                {
                    ret += (c - '0') / (div *= 10);
                }
            }

            if (neg)
                return -ret;
            return ret;
        }

        private void fillBuffer() throws IOException
        {
            bytesRead = din.read(buffer, bufferPointer = 0, BUFFER_SIZE);
            if (bytesRead == -1)
                buffer[0] = -1;
        }

        private byte read() throws IOException
        {
            if (bufferPointer == bytesRead)
                fillBuffer();
            return buffer[bufferPointer++];
        }

        public void close() throws IOException
        {
            if (din == null)
                return;
            din.close();
        }
    }
}

/* Mon Aug 12 2019 14:42:19 GMT+0300 (MSK) */


import java.io.*;
import java.util.*;
import java.math.*;

public class Main {

    FastScanner in;
    PrintWriter out;

    static class FastScanner {

        BufferedReader br;
        StringTokenizer st;

        FastScanner(InputStream in) {
            br = new BufferedReader(new InputStreamReader(in));
            st = null;
        }

        String next() throws IOException {
            while (st == null || !st.hasMoreTokens())
                st = new StringTokenizer(br.readLine());
            return st.nextToken();
        }

        String nextLine() throws IOException {
            if (st == null || !st.hasMoreTokens())
                return br.readLine();
            StringBuilder result = new StringBuilder(st.nextToken());
            while (st.hasMoreTokens()) {
                result.append(" ");
                result.append(st.nextToken());
            }
            return result.toString();
        }

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

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

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

    }

    void run() throws IOException {
        in = new FastScanner(System.in);
        out = new PrintWriter(System.out, false);
        solve();
        out.close();
    }

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

    public void printArr(int[] arr){
        for(int i = 0; i < arr.length; i++){
            out.print(arr[i] + " ");
        }
        out.println();
    }

    public long gcd(long a, long b){
        if(a == 0) return b;
        return gcd(b % a, a);
    }

    public void solve() throws IOException{

        int n = in.nextInt(), m = in.nextInt(), s = in.nextInt(), f = in.nextInt();
        int dir = Math.abs(f - s) / (f - s);
        int prevT = 0;

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

            int t = in.nextInt(), l = in.nextInt(), r = in.nextInt();

            //out.print("Time: " + t + " Cur: " + s+ " Res : ");

            int window = t - prevT - 1;
            if(window >= Math.abs(f - s)){
                out.print(String.join("", Collections.nCopies(Math.abs(f - s), (dir == -1 ? "L" : "R"))));
                return;
            }else{
                out.print(String.join("", Collections.nCopies(Math.abs(window), (dir == -1 ? "L" : "R"))));
                s += dir * window;
            }

            if((s >= l && s <= r) || ((s + dir) >= l && (s + dir) <= r)){
                out.print("X");
            }else{
                out.print((dir == -1 ? "L" : "R"));
                s += dir;
            }

            prevT = t;
            //out.println();

        }

        out.print(String.join("", Collections.nCopies(Math.abs(f - s), (dir == -1 ? "L" : "R"))));
        return;

    }

}


import java.io.*;
import java.util.*;
import java.math.*;

public class Main {

    FastScanner in;
    PrintWriter out;

    static class FastScanner {

        BufferedReader br;
        StringTokenizer st;

        FastScanner(InputStream in) {
            br = new BufferedReader(new InputStreamReader(in));
            st = null;
        }

        String next() throws IOException {
            while (st == null || !st.hasMoreTokens())
                st = new StringTokenizer(br.readLine());
            return st.nextToken();
        }

        String nextLine() throws IOException {
            if (st == null || !st.hasMoreTokens())
                return br.readLine();
            StringBuilder result = new StringBuilder(st.nextToken());
            while (st.hasMoreTokens()) {
                result.append(" ");
                result.append(st.nextToken());
            }
            return result.toString();
        }

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

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

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

    }

    void run() throws IOException {
        in = new FastScanner(System.in);
        out = new PrintWriter(System.out, false);
        solve();
        out.close();
    }

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

    public void printArr(int[] arr){
        for(int i = 0; i < arr.length; i++){
            out.print(arr[i] + " ");
        }
        out.println();
    }

    public long gcd(long a, long b){
        if(a == 0) return b;
        return gcd(b % a, a);
    }

    public void solve() throws IOException{

        int n = in.nextInt(), m = in.nextInt(), s = in.nextInt(), f = in.nextInt();
        int dir = Math.abs(f - s) / (f - s);
        int prevT = 0;

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

            int t = in.nextInt(), l = in.nextInt(), r = in.nextInt();

            //out.print(t);

            int window = t - prevT - 1;
            if(window >= Math.abs(f - s)){
                out.print(String.join("", Collections.nCopies(Math.abs(f - s), (dir == -1 ? "L" : "R"))));
                return;
            }

            if((s >= l && s <= r) || ((s + dir) >= l && (s + dir) <= r)){
                out.print("X");
                continue;
            }else{
                out.print((dir == -1 ? "L" : "R"));
                s += dir;
            }

            prevT = t;
            out.println();

        }

        out.print(String.join("", Collections.nCopies(Math.abs(f - s), (dir == -1 ? "L" : "R"))));

        return;

    }

}


import java.io.*;
import java.util.*;
import java.math.*;

public class Main {

    FastScanner in;
    PrintWriter out;

    static class FastScanner {

        BufferedReader br;
        StringTokenizer st;

        FastScanner(InputStream in) {
            br = new BufferedReader(new InputStreamReader(in));
            st = null;
        }

        String next() throws IOException {
            while (st == null || !st.hasMoreTokens())
                st = new StringTokenizer(br.readLine());
            return st.nextToken();
        }

        String nextLine() throws IOException {
            if (st == null || !st.hasMoreTokens())
                return br.readLine();
            StringBuilder result = new StringBuilder(st.nextToken());
            while (st.hasMoreTokens()) {
                result.append(" ");
                result.append(st.nextToken());
            }
            return result.toString();
        }

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

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

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

    }

    void run() throws IOException {
        in = new FastScanner(System.in);
        out = new PrintWriter(System.out, false);
        solve();
        out.close();
    }

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

    public void printArr(int[] arr){
        for(int i = 0; i < arr.length; i++){
            out.print(arr[i] + " ");
        }
        out.println();
    }

    public long gcd(long a, long b){
        if(a == 0) return b;
        return gcd(b % a, a);
    }

    public void solve() throws IOException{

        int n = in.nextInt(), m = in.nextInt(), s = in.nextInt(), f = in.nextInt();
        int dir = Math.abs(f - s) / (f - s);
        int prevT = 0;

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

            int t = in.nextInt(), l = in.nextInt(), r = in.nextInt();

            //out.print(t);

            int window = t - prevT - 1;
            if(window >= Math.abs(f - s)){
                out.print(String.join("", Collections.nCopies(Math.abs(f - s), (dir == -1 ? "L" : "R"))));
                return;
            }

            if((s >= l && s <= r) || ((s + dir) >= l && (s + dir) <= r)){
                out.print("X");
            }else{
                out.print((dir == -1 ? "L" : "R"));
                s += dir;
            }

            prevT = t;
            //out.println();

        }

        out.print(String.join("", Collections.nCopies(Math.abs(f - s), (dir == -1 ? "L" : "R"))));
        return;

    }

}