#include <vector>
#include <iostream>
#include <algorithm>
#include <iterator>

enum{FIRST, SECOND};

int query(std::vector<int>& v, int type)
{
    int start, end;
    if(type == FIRST)
    {
        std::cin >> start;
        v.erase(v.begin() + start - 1);
        return 1;
    }
    if(type == SECOND)
    {
        std::cin >> start >> end;
        v.erase(v.begin() + start - 1, v.begin() + end - 1);
        return 1;
    }
    return -1;
}

void answer(std::vector<int>& v)
{
    if(v.size() > 0)
    {
        std::cout << v.size() << std::endl;
        std::copy(v.begin(), v.end(), std::ostream_iterator<int>(std::cout, " "));
    }
}

int main() {
    int n, value;  // number of elements
    std::vector<int> numbers;
    
    std::cin >> n;
    for(int i = 0; i < n; i++)
    {
        std::cin >> value;
        numbers.push_back(value);
    }
    query(numbers, FIRST);
    query(numbers, SECOND);
    answer(numbers);
    return 0;
}