All problems

Classifying Gains, Losses, and Flat Days

easyPythonNumPynp.sign

Marchmont Fund's daily letter carries a strip of arrows under the chart, one per trading day, so a reader can see at a glance how the run of days went without reading any figures. The typesetter cannot work from the returns themselves; the strip is built from a code per day, and the code says only which way the day went. A day that closed exactly level is its own case — it is neither an up day nor a down day, and the letter has always shown it as flat.

Task: Print the direction code for each day.

Input

The first line holds an integer n, the count of trading days. Each of the next n lines holds one day's return, which may be positive, negative or exactly zero.

Output

One line holding n codes separated by single spaces, in the order the days were read. The code is 1 for a day that gained, -1 for a day that lost, and 0 for a day that closed exactly level. Write each as a plain integer.

Example:

Input:
4
5
-3
0
2

Output:
1 -1 0 1

Sign in to solve this problem

Reading problems is free for everyone — solving them (Run, Submit, and tracking what you've solved) needs an account.

Sign in

Discussion

Sign in to join the discussion — reading is open to everyone.

Loading comments…