LinkedList Simulate Number of Even Elements#10468

LinkedList Simulate Number of Even Elements

1 secondo
128 megabyte
Facile

An empty Linked List is given initially. Simulate the next operations:

- push front : add element to the front of a Linked List; - push back : add element to the back of a Linked List; - pop front: remove element from the front of a Linked List; - pop back: remove element from the back of a Linked List;

Let L = (a_1, a_2, \ldots, a_n) be the resulting Linked List. Find the number of all its even elements.

Input

Each line contains one of the operations described above. It is known that is a nonnegative integer, no more than . Final Linked List (after simulation) contains no more than elements.

Output

Print the number of all even elements in the resulting Linked List.

Esempi

Esempio 1

Loading
Loading

Nota

After simulation the list will have the next form:

The number of even elements is .