#include <bits/stdc++.h>
using namespace std;
int main() {
  std::ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.precision(10);
  int n;
  cin >> n;
  deque<int> a(n);
  string result;
  for (size_t i = 0; i < n; ++i) {
    cin >> a[i];
  }
  for (size_t i = 1; i <= n; ++i) {
    if (!a.empty()) {
      if (a.front() == i) {
        result += 'L';
        a.pop_front();
      } else if (a.back() == i) {
        result += 'R';
        a.pop_back();
      }
    }
  }
  cout << result.size() << '\n' << result << '\n';
  return 0;
}
