DIVREL - Divisibility Relation

no tags 

Given n positive integers. Your task is to select a maximum number of integers so that there are no two numbers a, b in which a is divisible by b.

Input

  • Line 1: n (1 ≤ n ≤ 200).
  • Line 2: n positive integers a1, a2, ..., an (1 ≤ ai ≤ 109).

Output

  • Line 1: k, the maximum number of integers that can be selected.
  • Line 2: k selected integers.

Example

Input
8
1 2 3 5 6 8 7 9

Output
5
5 6 8 7 9

Input
4
2 3 2 3

Output
2
2 3

hide comments
candide: 2014-05-05 02:58:22

Very interesting question but hard to solve if you don't know the trick.

Eternia: 2010-05-25 04:34:51

can we print any answer in arbitrary order?
Edit: solved.
you can print any answer in any order

Last edit: 2010-05-25 05:27:48
Navin Parakkal: 2009-07-31 22:44:32

can print put any maximum subset ?


Added by:Duc
Date:2008-10-22
Time limit:0.194s
Source limit:50000B
Memory limit:1536MB
Cluster: Cube (Intel G860)
Languages:All except: ERL JS-RHINO NODEJS PERL6 VB.NET
Resource:Vietnamese IOI Selection Test 2007