| Cupertino Informatics Tournament |
|---|
| Закончено |
Farmer John just discovered that he's missing cow treats! He knows that some cows have access to the secret cow treat stash (located in the warehouse), but he's not sure which one stole his treats. :(
However, after having been with his cows for a good 10 or so years, he knows about that his cows are usually very careful, especially when they're committing morally wrong acts. He theorizes that a cow will only steal treats if both conditions are satisfied:
1. They are alone in the warehouse at any given time
2. They never return to the warehouse when there are others present (they may be present with others before the time of the robbery, but they will not be seen in the room with another cow after the robbery)
Based on Farmer John's theory and the security camera footage, which shows when each cow entered and left the building, print out the names of the cows that could have committed this atrocious act.
The first line of the input contains the integer $$$n$$$ representing the number of times a cow enters or exits a barn. ($$$1 \le n \le 10^5$$$)
The next $$$n$$$ lines contain a single integer $$$x$$$ ($$$1 \le x \le 10^5$$$) indicating that if cow $$$x$$$ is already in the barn, it leaves and if it is not in the barn, it enters the barn. The barn starts off initially empty.
Print the numbers assigned to the cows who may have stolen the treats with one integer per line. Print the cows in sorted order.
10 96518 96518 4862 4862 90754 71337 71337 61387 95917 95917
4862 96518
| Название |
|---|


