SP6823 CFJUN21 - Seller Bob
Description
Last year Bob earned by selling memory sticks. During each of _n_ days of his work one of the two following events took place:
- A customer came to Bob and asked to sell him a 2 $ ^{x} $ MB memory stick. If Bob had such a stick, he sold it and got 2 $ ^{x} $ berllars.
- Bob won some programming competition and got a 2 $ ^{x} $ MB memory stick as a prize. Bob could choose whether to present this memory stick to one of his friends, or keep it.
Bob never kept more than one memory stick, as he feared to mix up their capacities, and deceive a customer unintentionally. . Now, knowing all the customers' demands and all the prizes won at programming competitions during the last _n_ days, Bob wants to know, how much money he could have earned, if he had acted optimally.
Input Format
The first input line contains number _n_ (1 n ) — amount of Bob's working days. The following _n_ lines contain the description of the days. Line sell x stands for a day when a customer came to Bob to buy a 2 $ ^{x} $ MB memory stick (0 x ). It's guaranteed that for each _x_ there is not more than one line sell x. Line win x stands for a day when Bob won a 2 $ ^{x} $ MB memory stick (0 x ).
Output Format
Output the maximum possible earnings for Bob in berllars, that he would have had if he had known all the events beforehand. Don't forget, please, that Bob can't keep more than one memory stick at a time.