← Home
package main

import (
	"bufio"
	"fmt"
	"io"
	"os"
)

func main() {
	data, _ := io.ReadAll(os.Stdin)
	idx := 0
	nextInt := func() int {
		for idx < len(data) && (data[idx] < '0' || data[idx] > '9') {
			idx++
		}
		val := 0
		for idx < len(data) && data[idx] >= '0' && data[idx] <= '9' {
			val = val*10 + int(data[idx]-'0')
			idx++
		}
		return val
	}

	n := nextInt()
	const maxV = 100000
	freq := make([]int, maxV+1)
	maxA := 0
	for i := 0; i < n; i++ {
		x := nextInt()
		freq[x]++
		if x > maxA {
			maxA = x
		}
	}

	ans := 1
	isComposite := make([]bool, maxA+1)
	for i := 2; i <= maxA; i++ {
		if !isComposite[i] {
			cnt := 0
			for j := i; j <= maxA; j += i {
				cnt += freq[j]
				if j > i {
					isComposite[j] = true
				}
			}
			if cnt > ans {
				ans = cnt
			}
		}
	}

	out := bufio.NewWriter(os.Stdout)
	fmt.Fprint(out, ans)
	out.Flush()
}