PHƯỚC HƯNG OJ · THỬ THÁCH THUẬT TOÁN

#CCBCHBAHAI0000174. Số giá trị khác nhau trong miền 0..1000 (Distinct Values in the Range 0..1000)

HỌC THEO LỘ TRÌNH

Bài tập thuộc lộ trình

1 lộ trình

Số giá trị khác nhau trong miền 0..1000 (Distinct Values in the Range 0..1000)

Distinct Values in the Range 0..1000

Source: Phước Hưng OJ

Version: Phuoc Hung OJ Extended

Problem

You are given an array aa of nn integers, each in the range [0,1000][0,1000].

Compute the number of distinct values in the array, i.e. the size of

S={ai∣1≤i≤n}.S=\{a_i\mid 1\le i\le n\}.

Input

  • The first line contains nn.
  • The second line contains a1,a2,…,ana_1,a_2,\ldots,a_n.

Output

Print ∣S∣|S|.

Subtasks

Subtask 1 (20 points): 1≤n≤501\le n\le 50 and 0≤ai≤1000\le a_i\le 100.

Subtask 2 (30 points): 1≤n≤50001\le n\le 5000 and 0≤ai≤5000\le a_i\le 500.

Subtask 3 (50 points): 1≤n≤1000001\le n\le 100000 and 0≤ai≤10000\le a_i\le 1000.

Example

Input

8
0 7 7 1000 0 5 5 9

Output

5

Explanation

The distinct values are {0,5,7,9,1000}, hence the answer is 5.