CF1209A.Paint the Numbers

传统题 时间 2000 ms 内存 256 MiB 3 尝试 1 已通过 1 标签

Paint the Numbers

You are given a sequence of integers a1,a2,,ana_1, a_2, \dots, a_n. You need to paint elements in colors, so that:

  • If we consider any color, all elements of this color must be divisible by the minimal element of this color.
  • The number of used colors must be minimized.

For example, it's fine to paint elements [40,10,60][40, 10, 60] in a single color, because they are all divisible by 1010. You can use any color an arbitrary amount of times (in particular, it is allowed to use a color only once). The elements painted in one color do not need to be consecutive.

For example, if a=[6,2,3,4,12]a=[6, 2, 3, 4, 12] then two colors are required: let's paint 66, 33 and 1212 in the first color (66, 33 and 1212 are divisible by 33) and paint 22 and 44 in the second color (22 and 44 are divisible by 22). For example, if a=[10,7,15]a=[10, 7, 15] then 33 colors are required (we can simply paint each element in an unique color).

Input

The first line contains an integer nn (1n1001 \le n \le 100), where nn is the length of the given sequence.

The second line contains nn integers a1,a2,,ana_1, a_2, \dots, a_n (1ai1001 \le a_i \le 100). These numbers can contain duplicates.

Output

Print the minimal number of colors to paint all the given numbers in a valid way.

Note

In the first example, one possible way to paint the elements in 33 colors is:

  • paint in the first color the elements: a1=10a_1=10 and a4=5a_4=5,
  • paint in the second color the element a3=3a_3=3,
  • paint in the third color the elements: a2=2a_2=2, a5=4a_5=4 and a6=2a_6=2.

In the second example, you can use one color to paint all the elements.

In the third example, one possible way to paint the elements in 44 colors is:

  • paint in the first color the elements: a4=4a_4=4, a6=2a_6=2 and a7=2a_7=2,
  • paint in the second color the elements: a2=6a_2=6, a5=3a_5=3 and a8=3a_8=3,
  • paint in the third color the element a3=5a_3=5,
  • paint in the fourth color the element a1=7a_1=7.

Samples

6
10 2 3 5 4 2
3
4
100 100 100 100
1
8
7 6 5 4 3 2 2 3
4

在线编程 IDE

建议全屏模式获得最佳体验