/*
 *
 *  Implementáció listával
 */

#include <iostream>
#include <list>

using namespace std;

int main()
{
    list<int> li;
    int ii;

    while ( cin >> ii )
    {
        li.push_back(ii);
    }
    cout << "elemszam = " << li.size() << endl;
    
    for (list<int>::iterator it = li.begin(); it != li.end(); ++it)
    {
        cout << *it << endl;
    }
    for (list<int>::reverse_iterator rt = li.rbegin(); rt != li.rend(); ++rt)
    {
        cout << *rt << endl;
    }
    return 0;
}