no tags 

They say "History repeats itself" and this is what happening in Bangladesh on Feb 2013.  Mass people fought the war in 1971 and now they are rising again to fight war criminals who betrayed the country. In "Shahbag" you can hear the voice of people wanting justice.

Shabag protest

If you go to shahbag you can see many human chains. For this problem we imagine a straight line going through middle of shahbag. Each position of the line is marked from 1 to 20000.

People are forming human chains along the line. Initially every position is empty. When someone stands in ithposition he holds hand of people who are standing in his left and right(if there any) and join there group. If there are no people beside him, he forms a new group.

When a new people come your job is to mark his position and count currently how many groups are there in shahbag.

For example suppose:

  1. a man came first and stood in postion 2. Currently there are only 1 group.
  2. then another man stood in position 4. Currently there are 2 groups.
  3. another man stood in position 3. Now there are only 1 group.

And yes, people wont leave until they get justice, so no need to worry about that.mi


There will be a single case. First line will contain an integer Q which denotes number of people. Next line will contain Q (1 <= Q <= 20000) integers pi which denotes position of i-th people that joined the chain. Each pi will be distinct and at most 20000.


For each pi print number of groups currently in shahbag. In last line print the string "Justice" with a newline. Do not print any extra spaces.


Sample Input:
2 4 3 6 7 5

Sample output:


This problem is based on true event. You can find the details here.

Alternate writer: Rashedul Hasan Rijul

hide comments
mahmud2690: 2017-05-12 14:43:39

What a stupid question. Waste of time

vengatesh15: 2017-02-05 07:45:15

easy one ...

srnsh: 2017-01-16 05:58:48

Too strict time limits for java.

rahadiankputra: 2016-10-27 10:42:02

Costed me 1 WA using array size of 20001, getting AC after changed the size of array to 30001.
What is the clear constraint for pi?

Jaswanth: 2015-08-11 17:43:16

just follow the above comments friends "\n" in Justice and array size of 30000 i tried without them got a WA

Ankit Sultana: 2015-06-09 22:02:32

use '\n' at the end of "Justice" and array size of 30000

Maroof: 2015-02-11 17:41:37

use \n in "Justice\n"

hitesh091: 2014-03-11 08:44:17

just use "\n" after Justice and array of 20002.

Neil Caffery: 2013-06-27 05:34:47

i used "Justice\n"; nd got ac.."Justice" gave WA (:

Added by:Shafaet
Time limit:0.134s
Source limit:50000B
Memory limit:1536MB
Cluster: Cube (Intel G860)
Languages:All except: ASM64