B - Market Price Movements Editorial /

Time Limit: 2 sec / Memory Limit: 1024 MiB

配点 : 233 点

問題文

高橋君はある商品の相場を N 日間記録しました。 i 日目の価格は A_i 円でした。

2 日目から N 日目までの各日について、前日と比べて価格が上がった日を「上昇日」、下がった日を「下落日」、同じだった日を「横ばい日」と呼びます。

上昇日、下落日、横ばい日がそれぞれ何日あったかを求めてください。

制約

  • 2 \leq N \leq 100
  • 1 \leq A_i \leq 10000
  • 入力はすべて整数

入力

入力は以下の形式で標準入力から与えられる。

N
A_1 A_2 \ldots A_N
  • 1 行目には、記録した日数 N が与えられる。
  • 2 行目には、各日の価格 A_1, A_2, \ldots, A_N がスペース区切りで与えられる。

出力

上昇日の数、下落日の数、横ばい日の数を、この順にスペース区切りで 1 行に出力せよ。


入力例 1

3
100 120 90

出力例 1

1 1 0

入力例 2

4
10 20 30 40

出力例 2

3 0 0

入力例 3

3
50 40 30

出力例 3

0 2 0

入力例 4

3
1301 2362 8372

出力例 4

2 0 0

入力例 5

2
2 5

出力例 5

1 0 0

Score : 233 pts

Problem Statement

Takahashi recorded the market price of a certain product for N days. The price on the i-th day was A_i yen.

For each day from day 2 to day N, we call a day an *up day* if the price increased compared to the previous day, a *down day* if it decreased, and a *flat day* if it stayed the same.

Find the number of up days, down days, and flat days.

Constraints

  • 2 \leq N \leq 100
  • 1 \leq A_i \leq 10000
  • All input values are integers.

Input

The input is given from standard input in the following format:

N
A_1 A_2 \ldots A_N
  • The first line contains the number of recorded days N.
  • The second line contains the prices A_1, A_2, \ldots, A_N for each day, separated by spaces.

Output

Print the number of up days, the number of down days, and the number of flat days in this order, separated by spaces, on a single line.


Sample Input 1

3
100 120 90

Sample Output 1

1 1 0

Sample Input 2

4
10 20 30 40

Sample Output 2

3 0 0

Sample Input 3

3
50 40 30

Sample Output 3

0 2 0

Sample Input 4

3
1301 2362 8372

Sample Output 4

2 0 0

Sample Input 5

2
2 5

Sample Output 5

1 0 0