#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, num = 1, i, a = 0;
  cin >> n;
  int arr[n];
  int b = n - 1;
  vector<char> vec;
  for (i = 0; i < n; i++) cin >> arr[i];
  while (1) {
    if (arr[a] == num) {
      vec.push_back('L');
      a++;
    } else if (arr[b] == num) {
      vec.push_back('R');
      b--;
    }
    if (num == n) break;
    num++;
  }
  cout << vec.size() << endl;
  for (auto i : vec) cout << i;
  cout << endl;
}
