unittest
{
	assert( [ "5", "24 11 8 3 16" ].parse.expand.solve == 3 );
	assert( [ "4", "5 5 5 5" ].parse.expand.solve == 0 );
	assert( [ "10", "33 18 45 28 8 19 89 86 2 4" ].parse.expand.solve == 5 );
}



import std.algorithm;
import std.conv;
import std.range;
import std.stdio;
import std.typecons;

void main()
{
	stdin.byLineCopy.parse.expand.solve.writeln;
}

auto parse( Range )( Range input )
if( isInputRange!Range && is( ElementType!Range == string ) )
{
	input.popFront;
	auto as = input.front.split.to!( long[] );
	return tuple( as );
}

auto solve( long[] as )
{
	auto ans = 0L;
	bool[ long ] ds;
	LOOP: foreach( a; as.sort() )
	{
		foreach( d; a.divisors )
		{
			if( d in ds ) continue LOOP;
		}
		ds[ a ] = true;
		ans++;
	}
	if( 2 <= as.length && as[ 0 ] == as[ 1 ] ) ans--;
	return ans;
}

// 約数列挙
auto divisors( long n )
{
	long[ long ] ds;
	auto s = cast( long ) n ^^ 0.5L;
	for( auto i = 1L; i <= s; i++ )
	{
		if( n % i != 0 ) continue;
		ds[ i     ] = true;
		ds[ n / i ] = true;
	}
	return ds.keys;
}
