using System;
using System.Collections.Generic;
using System.Collections;
using System.Linq;
using System.Numerics;
using System.Text;

namespace contest
{

    class contest
    {

        static void Main(string[] args)
        {

            //var num = Console.ReadLine().Split().Select(int.Parse).ToArray();
            //int n = num[0];
            //int m = num[1];

            //var input = Console.ReadLine().Split().Select(int.Parse).ToArray();

            //int n = int.Parse(Console.ReadLine());

            //var num = Console.ReadLine().Split().Select(int.Parse).ToArray();
            //for (int i = 0; i < n; i++)
            //{
            //    input[i] = Console.ReadLine().Split().Select(int.Parse).ToArray();

            //}

            //int n = int.Parse(Console.ReadLine());
            //var num = Console.ReadLine().Split().Select(int.Parse).ToArray();
            //int n = num[0];
            //int m = num[1];

            //int n = int.Parse(Console.ReadLine());
            //var num = Console.ReadLine().Split().Select(int.Parse).ToArray();

            //var arr = new int[n][];
            //for(int i =0; i< n; i++)
            //{
            //    arr[i] = Console.ReadLine().Split().Select(int.Parse).ToArray();
            //}

            int n = int.Parse(Console.ReadLine());
            var arr = Console.ReadLine().Split().Select(int.Parse).ToArray();

            Array.Sort(arr);
            var ch = new bool[n];
            //for(int i=0; i< n; i++)
            //{
            //    int cur = arr[i];
            //    if (isPrime(cur)) ch[i] = true;
            //}

            int mx = 1;
            //var memo = new bool[100001];
            for (int j = 2; j <= (int)Math.Sqrt(100000); j++)
            {
                //if (memo[j]) continue;
                int cnt = 0;
                for (int i = 0; i < n; i++)
                {
                    int cur = arr[i];
                    if (cur==1 || ch[i]) continue;
                    if (cur % j == 0)
                    {
                        cnt++;
                        //ch[i] = true;
                    }
                }
                //for (int i = j; i <= (int)Math.Sqrt(100000); i += j) memo[i] = true;
                mx = Math.Max(mx, cnt);
            }
            Console.WriteLine(mx);

            //Console.WriteLine();

            }

           public static bool isPrime(int a)
        {
            if (a == 1) return true;
            if (a == 2) return false;
            for(int i =2; i<=(int)Math.Sqrt(a); i++)
            {
                if (a % i == 0) return false;
            }
            return true;
        }

        public static int gcd(int a, int b)
        {
            if (a > b) gcd(b, a);
            if (a % b == 0) return b;
            return gcd(b, a % b);
        }

        }

        class Segment
        {
            //public int[] arr;
            public Tuple<int, int, int, int, int>[] arr;
            int n;

            public Segment(int n)
            {
                this.n = n * 2;
                //arr = Enumerable.Range(0, n*2).ToArray();
                //arr = new int[this.n];
                arr = new Tuple<int, int, int, int, int>[this.n];
                for (int i = 0; i < this.n; i++)
                {
                    arr[i] = Tuple.Create(0, 0, 0, 0, 0);
                }

            }

            public void update(int i, int x)
            {
                i = (n / 2) + i - 1;
                //arr[i] = 1;
                if (x == 2) arr[i] = Tuple.Create(1, 0, 0, 0, 0);
                else if (x == 0) arr[i] = Tuple.Create(0, 1, 0, 0, 0);
                else if (x == 1) arr[i] = Tuple.Create(0, 0, 1, 0, 0);
                else if (x == 6) arr[i] = Tuple.Create(0, 0, 0, 1, 0);
                else if (x == 7) arr[i] = Tuple.Create(0, 0, 0, 0, 1);

                while (i > 0)
                {
                    i = (i - 1) / 2;
                    //arr[i] = Math.Max(arr[i*2+1], arr[i*2+2]);
                    //if (arr[i * 2 + 1] > arr[i * 2 + 2])
                    //{
                    //    arr[i] = arr[i*2+1];
                    //}
                    //else
                    //{
                    //    arr[i] = arr[i*2+2];
                    //}
                    //arr[i] = arr[i * 2 + 1] + arr[i * 2 + 2];
                    arr[i] = Tuple.Create(arr[i * 2 + 1].Item1 + arr[i * 2 + 2].Item1,
                        arr[i * 2 + 1].Item2 + arr[i * 2 + 2].Item2,
                        arr[i * 2 + 1].Item3 + arr[i * 2 + 2].Item3,
                        arr[i * 2 + 1].Item4 + arr[i * 2 + 2].Item4,
                        arr[i * 2 + 1].Item5 + arr[i * 2 + 2].Item5);
                }

            }

            //call : query(a,b, 0, 0, n)
            public Tuple<int, int, int, int, int> query(int a, int b, int k, int l, int r)
            {
                if (r <= a || b <= l) return Tuple.Create(0, 0, 0, 0, 0);
                if (a <= l && r <= b) return arr[k];
                else
                {

                    var vl = query(a, b, k * 2 + 1, l, (l + r) / 2);
                    var vr = query(a, b, k * 2 + 2, (l + r) / 2, r);

                    //if (vl.Item4 > vr.Item4)
                    //{
                    //    return vl;
                    //}
                    ////else if (vl.Item4 == vr.Item4)
                    ////{
                    ////    if (countA >= countB) return vr;
                    ////    else return vl;
                    ////}
                    //else return vr;

                    return Tuple.Create(vl.Item1 + vr.Item1,
       vl.Item2 + vr.Item2,
       vl.Item3 + vr.Item3,
      vl.Item4 + vr.Item4,
       vl.Item5 + vr.Item5);

                    //return Math.Max(vl, vr);
                    //return vl
                    int countA = 0;
                    int countB = 0;
                    if (vl.Item1 == 0) countA++;
                    if (vl.Item2 == 0) countA++;
                    if (vl.Item3 == 0) countA++;
                    if (vl.Item4 == 0) countA++;
                    if (vl.Item5 == 0) countA++;

                    if (vr.Item1 == 0) countB++;
                    if (vr.Item2 == 0) countB++;
                    if (vr.Item3 == 0) countB++;
                    if (vr.Item4 == 0) countB++;
                    if (vr.Item5 == 0) countB++;

                    if ((vl.Item1 == 0 && vr.Item1 > 0))
                    {
                        return vr;
                    }
                    else if ((vl.Item1 > 0 && vr.Item1 == 0))
                    {
                        return vl;
                    }
                    else if ((vl.Item2 == 0 && vr.Item2 > 0))
                    {
                        return vr;
                    }
                    else if ((vl.Item2 > 0 && vr.Item2 == 0))
                    {
                        return vl;
                    }
                    else if ((vl.Item3 == 0 && vr.Item3 > 0))
                    {
                        return vr;
                    }
                    else if ((vl.Item3 > 0 && vr.Item3 == 0))
                    {
                        return vl;
                    }
                    else if ((vl.Item4 == 0 && vr.Item4 > 0))
                    {
                        return vr;
                    }
                    else if ((vl.Item4 > 0 && vr.Item4 == 0))
                    {
                        return vl;
                    }
                    else if ((vl.Item5 == 0 && vr.Item5 > 0))
                    {
                        return vr;
                    }
                    else if ((vl.Item5 > 0 && vr.Item5 == 0))
                    {
                        return vl;
                    }

                    if (vl.Item4 > vr.Item4)
                    {
                        return vl;
                    }
                    else if (vl.Item4 == vr.Item4)
                    {
                        if (countA >= countB) return vr;
                        else return vl;
                    }
                    else return vr;

                    //if (countA <= countB) return vl;
                    //else return vr;
                }
            }

        }

        class UnionFind
        {
            public int[] path;

            public UnionFind(int n)
            {
                path = new int[n];

                for (int i = 0; i < n; i++)
                {
                    path[i] = i;
                }

            }

            private int root(int i)
            {
                while (i != path[i])
                {
                    path[i] = path[path[i]];
                    i = path[i];
                }
                return i;
            }

            public bool find(int p, int q)
            {
                return root(p) == root(q);
            }

            public void unite(int p, int q)
            {
                int i = root(p);
                int j = root(q);
                path[i] = j;
            }

        }
    }


using System;
using System.Collections.Generic;
using System.Collections;
using System.Linq;
using System.Numerics;
using System.Text;

namespace contest
{

    class contest
    {

        static void Main(string[] args)
        {

            //int n = int.Parse(Console.ReadLine());

            //var num = Console.ReadLine().Split().Select(int.Parse).ToArray();
            //int n = num[0];
            //int m = num[1];

            //var num = Console.ReadLine().Split().Select(int.Parse).ToArray();
            //for (int i = 0; i < n; i++)
            //{
            //    input[i] = Console.ReadLine().Split().Select(int.Parse).ToArray();

            //}

            //int n = int.Parse(Console.ReadLine());
            //var num = Console.ReadLine().Split().Select(int.Parse).ToArray();

            //var arr = new int[n][];
            //for(int i =0; i< n; i++)
            //{
            //    arr[i] = Console.ReadLine().Split().Select(int.Parse).ToArray();
            //}

            int n = int.Parse(Console.ReadLine());
            var num = Console.ReadLine().Split().Select(int.Parse).ToArray();

            int ans = 0;

            Array.Sort(num);
            //int sqr = (int)Math.Sqrt(100000);
            var memo = new int[100001];
            //var ch = new bool[n];
            //for(int i =0; i< n; i++)
            //{
            //    int cur = num[i];
            //    if (isPrime(cur)) ch[i] = true;

            //}

            var ch = new bool[100001];
            for (int j = 2; j < memo.Length; j++)
            {
                if (ch[j]) continue;
                int cnt = 0;
                for (int i = 0; i < n; i++)
                {
                    int cur = num[i];
                    if (cur % j == 0) cnt++;

                }
                for (int k = j; k < memo.Length; k += j) ch[k] = true;
                ans = Math.Max(ans,cnt);
            }

            Console.WriteLine(ans);

            //Console.WriteLine();

        }

        public static int gcd(int a, int b)
        {
            if (a % b == 0) return b;
            else return gcd(b, a % b);
        }

        public static bool isPrime(int a)
        {
            for(int i = 2; i<=(int)Math.Sqrt(a); i++)
            {
                if (a % i == 0) return false;
            }
            return true;
        }
    }

    class Segment
    {
        //public int[] arr;
        public Tuple<int, int, int, int, int>[] arr;
        int n;

        public Segment(int n)
        {
            this.n = n * 2;
            //arr = Enumerable.Range(0, n*2).ToArray();
            //arr = new int[this.n];
            arr = new Tuple<int, int, int, int, int>[this.n];
            for (int i = 0; i < this.n; i++)
            {
                arr[i] = Tuple.Create(0, 0, 0, 0, 0);
            }

        }

        public void update(int i, int x)
        {
            i = (n / 2) + i - 1;
            //arr[i] = 1;
            if (x == 2) arr[i] = Tuple.Create(1, 0, 0, 0, 0);
            else if (x == 0) arr[i] = Tuple.Create(0, 1, 0, 0, 0);
            else if (x == 1) arr[i] = Tuple.Create(0, 0, 1, 0, 0);
            else if (x == 6) arr[i] = Tuple.Create(0, 0, 0, 1, 0);
            else if (x == 7) arr[i] = Tuple.Create(0, 0, 0, 0, 1);

            while (i > 0)
            {
                i = (i - 1) / 2;
                //arr[i] = Math.Max(arr[i*2+1], arr[i*2+2]);
                //if (arr[i * 2 + 1] > arr[i * 2 + 2])
                //{
                //    arr[i] = arr[i*2+1];
                //}
                //else
                //{
                //    arr[i] = arr[i*2+2];
                //}
                //arr[i] = arr[i * 2 + 1] + arr[i * 2 + 2];
                arr[i] = Tuple.Create(arr[i * 2 + 1].Item1 + arr[i * 2 + 2].Item1,
                    arr[i * 2 + 1].Item2 + arr[i * 2 + 2].Item2,
                    arr[i * 2 + 1].Item3 + arr[i * 2 + 2].Item3,
                    arr[i * 2 + 1].Item4 + arr[i * 2 + 2].Item4,
                    arr[i * 2 + 1].Item5 + arr[i * 2 + 2].Item5);
            }

        }

        //call : query(a,b, 0, 0, n)
        public Tuple<int, int, int, int, int> query(int a, int b, int k, int l, int r)
        {
            if (r <= a || b <= l) return Tuple.Create(0, 0, 0, 0, 0);
            if (a <= l && r <= b) return arr[k];
            else
            {

                var vl = query(a, b, k * 2 + 1, l, (l + r) / 2);
                var vr = query(a, b, k * 2 + 2, (l + r) / 2, r);

                //if (vl.Item4 > vr.Item4)
                //{
                //    return vl;
                //}
                ////else if (vl.Item4 == vr.Item4)
                ////{
                ////    if (countA >= countB) return vr;
                ////    else return vl;
                ////}
                //else return vr;

                return Tuple.Create(vl.Item1 + vr.Item1,
   vl.Item2 + vr.Item2,
   vl.Item3 + vr.Item3,
  vl.Item4 + vr.Item4,
   vl.Item5 + vr.Item5);

                //return Math.Max(vl, vr);
                //return vl
                int countA = 0;
                int countB = 0;
                if (vl.Item1 == 0) countA++;
                if (vl.Item2 == 0) countA++;
                if (vl.Item3 == 0) countA++;
                if (vl.Item4 == 0) countA++;
                if (vl.Item5 == 0) countA++;

                if (vr.Item1 == 0) countB++;
                if (vr.Item2 == 0) countB++;
                if (vr.Item3 == 0) countB++;
                if (vr.Item4 == 0) countB++;
                if (vr.Item5 == 0) countB++;

                if ((vl.Item1 == 0 && vr.Item1 > 0))
                {
                    return vr;
                }
                else if ((vl.Item1 > 0 && vr.Item1 == 0))
                {
                    return vl;
                }
                else if ((vl.Item2 == 0 && vr.Item2 > 0))
                {
                    return vr;
                }
                else if ((vl.Item2 > 0 && vr.Item2 == 0))
                {
                    return vl;
                }
                else if ((vl.Item3 == 0 && vr.Item3 > 0))
                {
                    return vr;
                }
                else if ((vl.Item3 > 0 && vr.Item3 == 0))
                {
                    return vl;
                }
                else if ((vl.Item4 == 0 && vr.Item4 > 0))
                {
                    return vr;
                }
                else if ((vl.Item4 > 0 && vr.Item4 == 0))
                {
                    return vl;
                }
                else if ((vl.Item5 == 0 && vr.Item5 > 0))
                {
                    return vr;
                }
                else if ((vl.Item5 > 0 && vr.Item5 == 0))
                {
                    return vl;
                }

                if (vl.Item4 > vr.Item4)
                {
                    return vl;
                }
                else if (vl.Item4 == vr.Item4)
                {
                    if (countA >= countB) return vr;
                    else return vl;
                }
                else return vr;

                //if (countA <= countB) return vl;
                //else return vr;
            }
        }

    }

    class UnionFind
    {
        public int[] path;

        public UnionFind(int n)
        {
            path = new int[n];

            for (int i = 0; i < n; i++)
            {
                path[i] = i;
            }

        }

        private int root(int i)
        {
            while (i != path[i])
            {
                path[i] = path[path[i]];
                i = path[i];
            }
            return i;
        }

        public bool find(int p, int q)
        {
            return root(p) == root(q);
        }

        public void unite(int p, int q)
        {
            int i = root(p);
            int j = root(q);
            path[i] = j;
        }

    }
}


using System;
using System.Collections.Generic;
using System.Collections;
using System.Linq;
using System.Numerics;
using System.Text;

namespace contest
{

    class contest
    {

        static void Main(string[] args)
        {

            //var num = Console.ReadLine().Split().Select(int.Parse).ToArray();
            //int n = num[0];
            //int m = num[1];

            //var input = Console.ReadLine().Split().Select(int.Parse).ToArray();

            //int n = int.Parse(Console.ReadLine());

            //var num = Console.ReadLine().Split().Select(int.Parse).ToArray();
            //for (int i = 0; i < n; i++)
            //{
            //    input[i] = Console.ReadLine().Split().Select(int.Parse).ToArray();

            //}

            //int n = int.Parse(Console.ReadLine());
            //var num = Console.ReadLine().Split().Select(int.Parse).ToArray();
            //int n = num[0];
            //int m = num[1];

            //int n = int.Parse(Console.ReadLine());
            //var num = Console.ReadLine().Split().Select(int.Parse).ToArray();

            //var arr = new int[n][];
            //for(int i =0; i< n; i++)
            //{
            //    arr[i] = Console.ReadLine().Split().Select(int.Parse).ToArray();
            //}

            int n = int.Parse(Console.ReadLine());
            var arr = Console.ReadLine().Split().Select(int.Parse).ToArray();

            Array.Sort(arr);
            //var ch = new bool[n];
            //for(int i=0; i< n; i++)
            //{
            //    int cur = arr[i];
            //    if (isPrime(cur)) ch[i] = true;
            //}

            var cntArr = new int[100001];
            for (int i=0; i< n; i++)
            {
                int cur = arr[i];
                if (cur == 1) continue;
                for(int j=2;j<=(int)Math.Sqrt(cur); j++)
                {
                    if (cur % j == 0) cntArr[j]++;
                }
                cntArr[cur]++;
            }

            int mx = cntArr.Max()>0? cntArr.Max(): 1;
            //int tmp = 1;
            //var memo = new int[n];
            //var cntArr = new int[100000];
            //for (int i = 0; i < n ; i++)
            //{
            //    int cur = arr[i];

            //    if (cur == 1) continue;
            //    int clc = findPrime(cur);
            //    //memo[i]=clc;
            //    cntArr[clc]++;

            //}
            //mx = cntArr.Max();

            //for(int i=0; i< n; i++)
            //{
            //    int cur = memo[i];
            //    if(cur)
            //}

            //var memo = new bool[100001];
            //for (int j = 2; j <= (int)Math.Sqrt(100000); j++)
            //{
            //    if (memo[j]) continue;
            //    int cnt = 0;
            //    for (int i = 0; i < n; i++)
            //    {
            //        int cur = arr[i];
            //        if (cur==1 || cur<j) continue;
            //        if (cur % j == 0)
            //        {
            //            cnt++;

            //        }
            //    }
            //    //for (int i = j; i <= 100000; i += j) memo[i] = true;
            //    mx = Math.Max(mx, cnt);
            //}

            Console.WriteLine(mx);

            //Console.WriteLine();

            }

        public static int findPrime(int a)
        {
            //if (a == 1) return true;
            //if (a == 2) return false;
            for (int i = 2; i <= (int)Math.Sqrt(a); i++)
            {
                if (a % i == 0) return i;
            }
            return a;
        }

        //public static int gcd(int a, int b)
        //{
        //    if (a > b) gcd(b, a);
        //    if (a % b == 0) return b;
        //    return gcd(b, a % b);
        //}

    }

        class Segment
        {
            //public int[] arr;
            public Tuple<int, int, int, int, int>[] arr;
            int n;

            public Segment(int n)
            {
                this.n = n * 2;
                //arr = Enumerable.Range(0, n*2).ToArray();
                //arr = new int[this.n];
                arr = new Tuple<int, int, int, int, int>[this.n];
                for (int i = 0; i < this.n; i++)
                {
                    arr[i] = Tuple.Create(0, 0, 0, 0, 0);
                }

            }

            public void update(int i, int x)
            {
                i = (n / 2) + i - 1;
                //arr[i] = 1;
                if (x == 2) arr[i] = Tuple.Create(1, 0, 0, 0, 0);
                else if (x == 0) arr[i] = Tuple.Create(0, 1, 0, 0, 0);
                else if (x == 1) arr[i] = Tuple.Create(0, 0, 1, 0, 0);
                else if (x == 6) arr[i] = Tuple.Create(0, 0, 0, 1, 0);
                else if (x == 7) arr[i] = Tuple.Create(0, 0, 0, 0, 1);

                while (i > 0)
                {
                    i = (i - 1) / 2;
                    //arr[i] = Math.Max(arr[i*2+1], arr[i*2+2]);
                    //if (arr[i * 2 + 1] > arr[i * 2 + 2])
                    //{
                    //    arr[i] = arr[i*2+1];
                    //}
                    //else
                    //{
                    //    arr[i] = arr[i*2+2];
                    //}
                    //arr[i] = arr[i * 2 + 1] + arr[i * 2 + 2];
                    arr[i] = Tuple.Create(arr[i * 2 + 1].Item1 + arr[i * 2 + 2].Item1,
                        arr[i * 2 + 1].Item2 + arr[i * 2 + 2].Item2,
                        arr[i * 2 + 1].Item3 + arr[i * 2 + 2].Item3,
                        arr[i * 2 + 1].Item4 + arr[i * 2 + 2].Item4,
                        arr[i * 2 + 1].Item5 + arr[i * 2 + 2].Item5);
                }

            }

            //call : query(a,b, 0, 0, n)
            public Tuple<int, int, int, int, int> query(int a, int b, int k, int l, int r)
            {
                if (r <= a || b <= l) return Tuple.Create(0, 0, 0, 0, 0);
                if (a <= l && r <= b) return arr[k];
                else
                {

                    var vl = query(a, b, k * 2 + 1, l, (l + r) / 2);
                    var vr = query(a, b, k * 2 + 2, (l + r) / 2, r);

                    //if (vl.Item4 > vr.Item4)
                    //{
                    //    return vl;
                    //}
                    ////else if (vl.Item4 == vr.Item4)
                    ////{
                    ////    if (countA >= countB) return vr;
                    ////    else return vl;
                    ////}
                    //else return vr;

                    return Tuple.Create(vl.Item1 + vr.Item1,
       vl.Item2 + vr.Item2,
       vl.Item3 + vr.Item3,
      vl.Item4 + vr.Item4,
       vl.Item5 + vr.Item5);

                    //return Math.Max(vl, vr);
                    //return vl
                    int countA = 0;
                    int countB = 0;
                    if (vl.Item1 == 0) countA++;
                    if (vl.Item2 == 0) countA++;
                    if (vl.Item3 == 0) countA++;
                    if (vl.Item4 == 0) countA++;
                    if (vl.Item5 == 0) countA++;

                    if (vr.Item1 == 0) countB++;
                    if (vr.Item2 == 0) countB++;
                    if (vr.Item3 == 0) countB++;
                    if (vr.Item4 == 0) countB++;
                    if (vr.Item5 == 0) countB++;

                    if ((vl.Item1 == 0 && vr.Item1 > 0))
                    {
                        return vr;
                    }
                    else if ((vl.Item1 > 0 && vr.Item1 == 0))
                    {
                        return vl;
                    }
                    else if ((vl.Item2 == 0 && vr.Item2 > 0))
                    {
                        return vr;
                    }
                    else if ((vl.Item2 > 0 && vr.Item2 == 0))
                    {
                        return vl;
                    }
                    else if ((vl.Item3 == 0 && vr.Item3 > 0))
                    {
                        return vr;
                    }
                    else if ((vl.Item3 > 0 && vr.Item3 == 0))
                    {
                        return vl;
                    }
                    else if ((vl.Item4 == 0 && vr.Item4 > 0))
                    {
                        return vr;
                    }
                    else if ((vl.Item4 > 0 && vr.Item4 == 0))
                    {
                        return vl;
                    }
                    else if ((vl.Item5 == 0 && vr.Item5 > 0))
                    {
                        return vr;
                    }
                    else if ((vl.Item5 > 0 && vr.Item5 == 0))
                    {
                        return vl;
                    }

                    if (vl.Item4 > vr.Item4)
                    {
                        return vl;
                    }
                    else if (vl.Item4 == vr.Item4)
                    {
                        if (countA >= countB) return vr;
                        else return vl;
                    }
                    else return vr;

                    //if (countA <= countB) return vl;
                    //else return vr;
                }
            }

        }

        class UnionFind
        {
            public int[] path;

            public UnionFind(int n)
            {
                path = new int[n];

                for (int i = 0; i < n; i++)
                {
                    path[i] = i;
                }

            }

            private int root(int i)
            {
                while (i != path[i])
                {
                    path[i] = path[path[i]];
                    i = path[i];
                }
                return i;
            }

            public bool find(int p, int q)
            {
                return root(p) == root(q);
            }

            public void unite(int p, int q)
            {
                int i = root(p);
                int j = root(q);
                path[i] = j;
            }

        }
    }


using System;
using System.Collections.Generic;
using System.Collections;
using System.Linq;
using System.Numerics;
using System.Text;

namespace contest
{

    class contest
    {

        static void Main(string[] args)
        {

            //var num = Console.ReadLine().Split().Select(int.Parse).ToArray();
            //int n = num[0];
            //int m = num[1];

            //var input = Console.ReadLine().Split().Select(int.Parse).ToArray();

            //int n = int.Parse(Console.ReadLine());

            //var num = Console.ReadLine().Split().Select(int.Parse).ToArray();
            //for (int i = 0; i < n; i++)
            //{
            //    input[i] = Console.ReadLine().Split().Select(int.Parse).ToArray();

            //}

            //int n = int.Parse(Console.ReadLine());
            //var num = Console.ReadLine().Split().Select(int.Parse).ToArray();
            //int n = num[0];
            //int m = num[1];

            //int n = int.Parse(Console.ReadLine());
            //var num = Console.ReadLine().Split().Select(int.Parse).ToArray();

            //var arr = new int[n][];
            //for(int i =0; i< n; i++)
            //{
            //    arr[i] = Console.ReadLine().Split().Select(int.Parse).ToArray();
            //}

            int n = int.Parse(Console.ReadLine());
            var arr = Console.ReadLine().Split().Select(int.Parse).ToArray();

            Array.Sort(arr);
            //var ch = new bool[n];
            //for(int i=0; i< n; i++)
            //{
            //    int cur = arr[i];
            //    if (isPrime(cur)) ch[i] = true;
            //}

            //var mm = new bool[n];
            //ch.CopyTo(mm,0);
            //int mx = 1;
            //for (int i = 0; i < n; i++)
            //{
            //    if (!mm[i]) continue;
            //    int cur = arr[i];
            //    int cnt = 1;
            //    for(int j= i+1; j< n; j++)
            //    {
            //        if (mm[i]) continue;
            //        if (arr[j] % cur == 0)
            //        {
            //            cnt++;
            //            mm[j] = true;
            //        }
            //    }
            //    mx = Math.Max(mx, cnt);
            //}

            //Console.WriteLine(Math.Sqrt(100000));
            int mx = 1;
            int tmp = 1;
            for (int i = 0; i < n - 1; i++)
            {
                int cur = arr[i];
                int nx = arr[i + 1];
                if (cur == 1) continue;
                if (cur == nx) tmp++;
                else
                {

                    tmp = 1;
                }

                mx = Math.Max(mx, tmp);
            }

            var memo = new bool[100001];
            for (int j = 2; j <= 1000; j++)
            {
                //if (memo[j]) continue;
                int cnt = 0;
                for (int i = 0; i < n; i++)
                {
                    int cur = arr[i];
                    if (cur==1 ) continue;
                    if (cur % j == 0)
                    {
                        cnt++;
                        //memo[i]=true;
                    }
                }
                //for (int i = j; i <= 100000; i += j) memo[i] = true;
                mx = Math.Max(mx, cnt);
            }
            Console.WriteLine(mx);

            //Console.WriteLine();

            }

        public static bool isPrime(int a)
        {
            if (a == 1) return true;
            if (a == 2) return false;
            for (int i = 2; i <= (int)Math.Sqrt(a); i++)
            {
                if (a % i == 0) return false;
            }
            return true;
        }

        //public static int gcd(int a, int b)
        //{
        //    if (a > b) gcd(b, a);
        //    if (a % b == 0) return b;
        //    return gcd(b, a % b);
        //}

    }

        class Segment
        {
            //public int[] arr;
            public Tuple<int, int, int, int, int>[] arr;
            int n;

            public Segment(int n)
            {
                this.n = n * 2;
                //arr = Enumerable.Range(0, n*2).ToArray();
                //arr = new int[this.n];
                arr = new Tuple<int, int, int, int, int>[this.n];
                for (int i = 0; i < this.n; i++)
                {
                    arr[i] = Tuple.Create(0, 0, 0, 0, 0);
                }

            }

            public void update(int i, int x)
            {
                i = (n / 2) + i - 1;
                //arr[i] = 1;
                if (x == 2) arr[i] = Tuple.Create(1, 0, 0, 0, 0);
                else if (x == 0) arr[i] = Tuple.Create(0, 1, 0, 0, 0);
                else if (x == 1) arr[i] = Tuple.Create(0, 0, 1, 0, 0);
                else if (x == 6) arr[i] = Tuple.Create(0, 0, 0, 1, 0);
                else if (x == 7) arr[i] = Tuple.Create(0, 0, 0, 0, 1);

                while (i > 0)
                {
                    i = (i - 1) / 2;
                    //arr[i] = Math.Max(arr[i*2+1], arr[i*2+2]);
                    //if (arr[i * 2 + 1] > arr[i * 2 + 2])
                    //{
                    //    arr[i] = arr[i*2+1];
                    //}
                    //else
                    //{
                    //    arr[i] = arr[i*2+2];
                    //}
                    //arr[i] = arr[i * 2 + 1] + arr[i * 2 + 2];
                    arr[i] = Tuple.Create(arr[i * 2 + 1].Item1 + arr[i * 2 + 2].Item1,
                        arr[i * 2 + 1].Item2 + arr[i * 2 + 2].Item2,
                        arr[i * 2 + 1].Item3 + arr[i * 2 + 2].Item3,
                        arr[i * 2 + 1].Item4 + arr[i * 2 + 2].Item4,
                        arr[i * 2 + 1].Item5 + arr[i * 2 + 2].Item5);
                }

            }

            //call : query(a,b, 0, 0, n)
            public Tuple<int, int, int, int, int> query(int a, int b, int k, int l, int r)
            {
                if (r <= a || b <= l) return Tuple.Create(0, 0, 0, 0, 0);
                if (a <= l && r <= b) return arr[k];
                else
                {

                    var vl = query(a, b, k * 2 + 1, l, (l + r) / 2);
                    var vr = query(a, b, k * 2 + 2, (l + r) / 2, r);

                    //if (vl.Item4 > vr.Item4)
                    //{
                    //    return vl;
                    //}
                    ////else if (vl.Item4 == vr.Item4)
                    ////{
                    ////    if (countA >= countB) return vr;
                    ////    else return vl;
                    ////}
                    //else return vr;

                    return Tuple.Create(vl.Item1 + vr.Item1,
       vl.Item2 + vr.Item2,
       vl.Item3 + vr.Item3,
      vl.Item4 + vr.Item4,
       vl.Item5 + vr.Item5);

                    //return Math.Max(vl, vr);
                    //return vl
                    int countA = 0;
                    int countB = 0;
                    if (vl.Item1 == 0) countA++;
                    if (vl.Item2 == 0) countA++;
                    if (vl.Item3 == 0) countA++;
                    if (vl.Item4 == 0) countA++;
                    if (vl.Item5 == 0) countA++;

                    if (vr.Item1 == 0) countB++;
                    if (vr.Item2 == 0) countB++;
                    if (vr.Item3 == 0) countB++;
                    if (vr.Item4 == 0) countB++;
                    if (vr.Item5 == 0) countB++;

                    if ((vl.Item1 == 0 && vr.Item1 > 0))
                    {
                        return vr;
                    }
                    else if ((vl.Item1 > 0 && vr.Item1 == 0))
                    {
                        return vl;
                    }
                    else if ((vl.Item2 == 0 && vr.Item2 > 0))
                    {
                        return vr;
                    }
                    else if ((vl.Item2 > 0 && vr.Item2 == 0))
                    {
                        return vl;
                    }
                    else if ((vl.Item3 == 0 && vr.Item3 > 0))
                    {
                        return vr;
                    }
                    else if ((vl.Item3 > 0 && vr.Item3 == 0))
                    {
                        return vl;
                    }
                    else if ((vl.Item4 == 0 && vr.Item4 > 0))
                    {
                        return vr;
                    }
                    else if ((vl.Item4 > 0 && vr.Item4 == 0))
                    {
                        return vl;
                    }
                    else if ((vl.Item5 == 0 && vr.Item5 > 0))
                    {
                        return vr;
                    }
                    else if ((vl.Item5 > 0 && vr.Item5 == 0))
                    {
                        return vl;
                    }

                    if (vl.Item4 > vr.Item4)
                    {
                        return vl;
                    }
                    else if (vl.Item4 == vr.Item4)
                    {
                        if (countA >= countB) return vr;
                        else return vl;
                    }
                    else return vr;

                    //if (countA <= countB) return vl;
                    //else return vr;
                }
            }

        }

        class UnionFind
        {
            public int[] path;

            public UnionFind(int n)
            {
                path = new int[n];

                for (int i = 0; i < n; i++)
                {
                    path[i] = i;
                }

            }

            private int root(int i)
            {
                while (i != path[i])
                {
                    path[i] = path[path[i]];
                    i = path[i];
                }
                return i;
            }

            public bool find(int p, int q)
            {
                return root(p) == root(q);
            }

            public void unite(int p, int q)
            {
                int i = root(p);
                int j = root(q);
                path[i] = j;
            }

        }
    }


using System;
using System.Collections.Generic;
using System.Collections;
using System.Linq;
using System.Numerics;
using System.Text;

namespace contest
{

    class contest
    {

        static void Main(string[] args)
        {

            //var num = Console.ReadLine().Split().Select(int.Parse).ToArray();
            //int n = num[0];
            //int m = num[1];

            //var input = Console.ReadLine().Split().Select(int.Parse).ToArray();

            //int n = int.Parse(Console.ReadLine());

            //var num = Console.ReadLine().Split().Select(int.Parse).ToArray();
            //for (int i = 0; i < n; i++)
            //{
            //    input[i] = Console.ReadLine().Split().Select(int.Parse).ToArray();

            //}

            //int n = int.Parse(Console.ReadLine());
            //var num = Console.ReadLine().Split().Select(int.Parse).ToArray();
            //int n = num[0];
            //int m = num[1];

            //int n = int.Parse(Console.ReadLine());
            //var num = Console.ReadLine().Split().Select(int.Parse).ToArray();

            //var arr = new int[n][];
            //for(int i =0; i< n; i++)
            //{
            //    arr[i] = Console.ReadLine().Split().Select(int.Parse).ToArray();
            //}

            int n = int.Parse(Console.ReadLine());
            var arr = Console.ReadLine().Split().Select(int.Parse).ToArray();

            Array.Sort(arr);
            var ch = new bool[n];

            int mx = 1;
            var memo = new bool[100001];
            for (int j = 2; j <= 100000; j++)
            {
                if (memo[j]) continue;
                int cnt = 0;
                for (int i = 0; i < n; i++)
                {
                    int cur = arr[i];
                    if (cur==1 ) continue;
                    if (cur % j == 0)
                    {
                        cnt++;

                    }
                }
                for (int i = j; i <= 100000; i += j) memo[i] = true;
                mx = Math.Max(mx, cnt);
            }
            Console.WriteLine(mx);

            //Console.WriteLine();

            }

           public static bool isPrime(int a)
        {
            if (a == 1) return true;
            if (a == 2) return false;
            for(int i =2; i<=(int)Math.Sqrt(a); i++)
            {
                if (a % i == 0) return false;
            }
            return true;
        }

        public static int gcd(int a, int b)
        {
            if (a > b) gcd(b, a);
            if (a % b == 0) return b;
            return gcd(b, a % b);
        }

        }

        class Segment
        {
            //public int[] arr;
            public Tuple<int, int, int, int, int>[] arr;
            int n;

            public Segment(int n)
            {
                this.n = n * 2;
                //arr = Enumerable.Range(0, n*2).ToArray();
                //arr = new int[this.n];
                arr = new Tuple<int, int, int, int, int>[this.n];
                for (int i = 0; i < this.n; i++)
                {
                    arr[i] = Tuple.Create(0, 0, 0, 0, 0);
                }

            }

            public void update(int i, int x)
            {
                i = (n / 2) + i - 1;
                //arr[i] = 1;
                if (x == 2) arr[i] = Tuple.Create(1, 0, 0, 0, 0);
                else if (x == 0) arr[i] = Tuple.Create(0, 1, 0, 0, 0);
                else if (x == 1) arr[i] = Tuple.Create(0, 0, 1, 0, 0);
                else if (x == 6) arr[i] = Tuple.Create(0, 0, 0, 1, 0);
                else if (x == 7) arr[i] = Tuple.Create(0, 0, 0, 0, 1);

                while (i > 0)
                {
                    i = (i - 1) / 2;
                    //arr[i] = Math.Max(arr[i*2+1], arr[i*2+2]);
                    //if (arr[i * 2 + 1] > arr[i * 2 + 2])
                    //{
                    //    arr[i] = arr[i*2+1];
                    //}
                    //else
                    //{
                    //    arr[i] = arr[i*2+2];
                    //}
                    //arr[i] = arr[i * 2 + 1] + arr[i * 2 + 2];
                    arr[i] = Tuple.Create(arr[i * 2 + 1].Item1 + arr[i * 2 + 2].Item1,
                        arr[i * 2 + 1].Item2 + arr[i * 2 + 2].Item2,
                        arr[i * 2 + 1].Item3 + arr[i * 2 + 2].Item3,
                        arr[i * 2 + 1].Item4 + arr[i * 2 + 2].Item4,
                        arr[i * 2 + 1].Item5 + arr[i * 2 + 2].Item5);
                }

            }

            //call : query(a,b, 0, 0, n)
            public Tuple<int, int, int, int, int> query(int a, int b, int k, int l, int r)
            {
                if (r <= a || b <= l) return Tuple.Create(0, 0, 0, 0, 0);
                if (a <= l && r <= b) return arr[k];
                else
                {

                    var vl = query(a, b, k * 2 + 1, l, (l + r) / 2);
                    var vr = query(a, b, k * 2 + 2, (l + r) / 2, r);

                    //if (vl.Item4 > vr.Item4)
                    //{
                    //    return vl;
                    //}
                    ////else if (vl.Item4 == vr.Item4)
                    ////{
                    ////    if (countA >= countB) return vr;
                    ////    else return vl;
                    ////}
                    //else return vr;

                    return Tuple.Create(vl.Item1 + vr.Item1,
       vl.Item2 + vr.Item2,
       vl.Item3 + vr.Item3,
      vl.Item4 + vr.Item4,
       vl.Item5 + vr.Item5);

                    //return Math.Max(vl, vr);
                    //return vl
                    int countA = 0;
                    int countB = 0;
                    if (vl.Item1 == 0) countA++;
                    if (vl.Item2 == 0) countA++;
                    if (vl.Item3 == 0) countA++;
                    if (vl.Item4 == 0) countA++;
                    if (vl.Item5 == 0) countA++;

                    if (vr.Item1 == 0) countB++;
                    if (vr.Item2 == 0) countB++;
                    if (vr.Item3 == 0) countB++;
                    if (vr.Item4 == 0) countB++;
                    if (vr.Item5 == 0) countB++;

                    if ((vl.Item1 == 0 && vr.Item1 > 0))
                    {
                        return vr;
                    }
                    else if ((vl.Item1 > 0 && vr.Item1 == 0))
                    {
                        return vl;
                    }
                    else if ((vl.Item2 == 0 && vr.Item2 > 0))
                    {
                        return vr;
                    }
                    else if ((vl.Item2 > 0 && vr.Item2 == 0))
                    {
                        return vl;
                    }
                    else if ((vl.Item3 == 0 && vr.Item3 > 0))
                    {
                        return vr;
                    }
                    else if ((vl.Item3 > 0 && vr.Item3 == 0))
                    {
                        return vl;
                    }
                    else if ((vl.Item4 == 0 && vr.Item4 > 0))
                    {
                        return vr;
                    }
                    else if ((vl.Item4 > 0 && vr.Item4 == 0))
                    {
                        return vl;
                    }
                    else if ((vl.Item5 == 0 && vr.Item5 > 0))
                    {
                        return vr;
                    }
                    else if ((vl.Item5 > 0 && vr.Item5 == 0))
                    {
                        return vl;
                    }

                    if (vl.Item4 > vr.Item4)
                    {
                        return vl;
                    }
                    else if (vl.Item4 == vr.Item4)
                    {
                        if (countA >= countB) return vr;
                        else return vl;
                    }
                    else return vr;

                    //if (countA <= countB) return vl;
                    //else return vr;
                }
            }

        }

        class UnionFind
        {
            public int[] path;

            public UnionFind(int n)
            {
                path = new int[n];

                for (int i = 0; i < n; i++)
                {
                    path[i] = i;
                }

            }

            private int root(int i)
            {
                while (i != path[i])
                {
                    path[i] = path[path[i]];
                    i = path[i];
                }
                return i;
            }

            public bool find(int p, int q)
            {
                return root(p) == root(q);
            }

            public void unite(int p, int q)
            {
                int i = root(p);
                int j = root(q);
                path[i] = j;
            }

        }
    }


using System;
using System.Collections.Generic;
using System.Collections;
using System.Linq;
using System.Numerics;
using System.Text;

namespace contest
{

    class contest
    {

        static void Main(string[] args)
        {

            //var num = Console.ReadLine().Split().Select(int.Parse).ToArray();
            //int n = num[0];
            //int m = num[1];

            //var input = Console.ReadLine().Split().Select(int.Parse).ToArray();

            //int n = int.Parse(Console.ReadLine());

            //var num = Console.ReadLine().Split().Select(int.Parse).ToArray();
            //for (int i = 0; i < n; i++)
            //{
            //    input[i] = Console.ReadLine().Split().Select(int.Parse).ToArray();

            //}

            //int n = int.Parse(Console.ReadLine());
            //var num = Console.ReadLine().Split().Select(int.Parse).ToArray();
            //int n = num[0];
            //int m = num[1];

            //int n = int.Parse(Console.ReadLine());
            //var num = Console.ReadLine().Split().Select(int.Parse).ToArray();

            //var arr = new int[n][];
            //for(int i =0; i< n; i++)
            //{
            //    arr[i] = Console.ReadLine().Split().Select(int.Parse).ToArray();
            //}

            int n = int.Parse(Console.ReadLine());
            var arr = Console.ReadLine().Split().Select(int.Parse).ToArray();

            Array.Sort(arr);
            var ch = new bool[n];
            for(int i=0; i< n; i++)
            {
                int cur = arr[i];
                if (isPrime(cur)) ch[i] = true;
            }

            var mm = new bool[n];
            ch.CopyTo(mm,0);
            int mx = 1;
            for (int i = 0; i < n; i++)
            {
                if (!mm[i]) continue;
                int cur = arr[i];
                int cnt = 1;
                for(int j= i+1; j< n; j++)
                {
                    if (mm[i]) continue;
                    if (arr[j] % cur == 0)
                    {
                        cnt++;
                        mm[j] = true;
                    }
                }
                mx = Math.Max(mx, cnt);
            }

            int tmp = 1;
            for (int i = 0; i < n-1; i++)
            {
                int cur = arr[i];
                int nx = arr[i + 1];
                if (cur == nx) tmp++;
                else
                {

                    tmp = 1;
                }

                mx = Math.Max(mx, tmp);
            }

            var memo = new bool[100001];
            for (int j = 2; j <= (int)Math.Sqrt(100000); j++)
            {
                if (memo[j]) continue;
                int cnt = 0;
                for (int i = 0; i < n; i++)
                {
                    int cur = arr[i];
                    if (cur==1 ||ch[i]) continue;
                    if (cur % j == 0)
                    {
                        cnt++;
                        //memo[i]=true;
                    }
                }
                for (int i = j; i <= 100000; i += j) memo[i] = true;
                mx = Math.Max(mx, cnt);
            }
            Console.WriteLine(mx);

            //Console.WriteLine();

            }

        public static bool isPrime(int a)
        {
            if (a == 1) return true;
            if (a == 2) return false;
            for (int i = 2; i <= (int)Math.Sqrt(a); i++)
            {
                if (a % i == 0) return false;
            }
            return true;
        }

        //public static int gcd(int a, int b)
        //{
        //    if (a > b) gcd(b, a);
        //    if (a % b == 0) return b;
        //    return gcd(b, a % b);
        //}

    }

        class Segment
        {
            //public int[] arr;
            public Tuple<int, int, int, int, int>[] arr;
            int n;

            public Segment(int n)
            {
                this.n = n * 2;
                //arr = Enumerable.Range(0, n*2).ToArray();
                //arr = new int[this.n];
                arr = new Tuple<int, int, int, int, int>[this.n];
                for (int i = 0; i < this.n; i++)
                {
                    arr[i] = Tuple.Create(0, 0, 0, 0, 0);
                }

            }

            public void update(int i, int x)
            {
                i = (n / 2) + i - 1;
                //arr[i] = 1;
                if (x == 2) arr[i] = Tuple.Create(1, 0, 0, 0, 0);
                else if (x == 0) arr[i] = Tuple.Create(0, 1, 0, 0, 0);
                else if (x == 1) arr[i] = Tuple.Create(0, 0, 1, 0, 0);
                else if (x == 6) arr[i] = Tuple.Create(0, 0, 0, 1, 0);
                else if (x == 7) arr[i] = Tuple.Create(0, 0, 0, 0, 1);

                while (i > 0)
                {
                    i = (i - 1) / 2;
                    //arr[i] = Math.Max(arr[i*2+1], arr[i*2+2]);
                    //if (arr[i * 2 + 1] > arr[i * 2 + 2])
                    //{
                    //    arr[i] = arr[i*2+1];
                    //}
                    //else
                    //{
                    //    arr[i] = arr[i*2+2];
                    //}
                    //arr[i] = arr[i * 2 + 1] + arr[i * 2 + 2];
                    arr[i] = Tuple.Create(arr[i * 2 + 1].Item1 + arr[i * 2 + 2].Item1,
                        arr[i * 2 + 1].Item2 + arr[i * 2 + 2].Item2,
                        arr[i * 2 + 1].Item3 + arr[i * 2 + 2].Item3,
                        arr[i * 2 + 1].Item4 + arr[i * 2 + 2].Item4,
                        arr[i * 2 + 1].Item5 + arr[i * 2 + 2].Item5);
                }

            }

            //call : query(a,b, 0, 0, n)
            public Tuple<int, int, int, int, int> query(int a, int b, int k, int l, int r)
            {
                if (r <= a || b <= l) return Tuple.Create(0, 0, 0, 0, 0);
                if (a <= l && r <= b) return arr[k];
                else
                {

                    var vl = query(a, b, k * 2 + 1, l, (l + r) / 2);
                    var vr = query(a, b, k * 2 + 2, (l + r) / 2, r);

                    //if (vl.Item4 > vr.Item4)
                    //{
                    //    return vl;
                    //}
                    ////else if (vl.Item4 == vr.Item4)
                    ////{
                    ////    if (countA >= countB) return vr;
                    ////    else return vl;
                    ////}
                    //else return vr;

                    return Tuple.Create(vl.Item1 + vr.Item1,
       vl.Item2 + vr.Item2,
       vl.Item3 + vr.Item3,
      vl.Item4 + vr.Item4,
       vl.Item5 + vr.Item5);

                    //return Math.Max(vl, vr);
                    //return vl
                    int countA = 0;
                    int countB = 0;
                    if (vl.Item1 == 0) countA++;
                    if (vl.Item2 == 0) countA++;
                    if (vl.Item3 == 0) countA++;
                    if (vl.Item4 == 0) countA++;
                    if (vl.Item5 == 0) countA++;

                    if (vr.Item1 == 0) countB++;
                    if (vr.Item2 == 0) countB++;
                    if (vr.Item3 == 0) countB++;
                    if (vr.Item4 == 0) countB++;
                    if (vr.Item5 == 0) countB++;

                    if ((vl.Item1 == 0 && vr.Item1 > 0))
                    {
                        return vr;
                    }
                    else if ((vl.Item1 > 0 && vr.Item1 == 0))
                    {
                        return vl;
                    }
                    else if ((vl.Item2 == 0 && vr.Item2 > 0))
                    {
                        return vr;
                    }
                    else if ((vl.Item2 > 0 && vr.Item2 == 0))
                    {
                        return vl;
                    }
                    else if ((vl.Item3 == 0 && vr.Item3 > 0))
                    {
                        return vr;
                    }
                    else if ((vl.Item3 > 0 && vr.Item3 == 0))
                    {
                        return vl;
                    }
                    else if ((vl.Item4 == 0 && vr.Item4 > 0))
                    {
                        return vr;
                    }
                    else if ((vl.Item4 > 0 && vr.Item4 == 0))
                    {
                        return vl;
                    }
                    else if ((vl.Item5 == 0 && vr.Item5 > 0))
                    {
                        return vr;
                    }
                    else if ((vl.Item5 > 0 && vr.Item5 == 0))
                    {
                        return vl;
                    }

                    if (vl.Item4 > vr.Item4)
                    {
                        return vl;
                    }
                    else if (vl.Item4 == vr.Item4)
                    {
                        if (countA >= countB) return vr;
                        else return vl;
                    }
                    else return vr;

                    //if (countA <= countB) return vl;
                    //else return vr;
                }
            }

        }

        class UnionFind
        {
            public int[] path;

            public UnionFind(int n)
            {
                path = new int[n];

                for (int i = 0; i < n; i++)
                {
                    path[i] = i;
                }

            }

            private int root(int i)
            {
                while (i != path[i])
                {
                    path[i] = path[path[i]];
                    i = path[i];
                }
                return i;
            }

            public bool find(int p, int q)
            {
                return root(p) == root(q);
            }

            public void unite(int p, int q)
            {
                int i = root(p);
                int j = root(q);
                path[i] = j;
            }

        }
    }


using System;
using System.Collections.Generic;
using System.Collections;
using System.Linq;
using System.Numerics;
using System.Text;

namespace contest
{

    class contest
    {

        static void Main(string[] args)
        {

            //int n = int.Parse(Console.ReadLine());

            //var num = Console.ReadLine().Split().Select(int.Parse).ToArray();
            //int n = num[0];
            //int m = num[1];

            //var num = Console.ReadLine().Split().Select(int.Parse).ToArray();
            //for (int i = 0; i < n; i++)
            //{
            //    input[i] = Console.ReadLine().Split().Select(int.Parse).ToArray();

            //}

            //int n = int.Parse(Console.ReadLine());
            //var num = Console.ReadLine().Split().Select(int.Parse).ToArray();

            //var arr = new int[n][];
            //for(int i =0; i< n; i++)
            //{
            //    arr[i] = Console.ReadLine().Split().Select(int.Parse).ToArray();
            //}

            int n = int.Parse(Console.ReadLine());
            var num = Console.ReadLine().Split().Select(int.Parse).ToArray();

            int ans = 1;

            Array.Sort(num);
            int sqr = (int)Math.Sqrt(100000);
            var memo = new int[sqr];
            var mm = new bool[n];
            for (int i = 0; i < n; i++)
            {
                int cur = num[i];
                if (isPrime(cur)) mm[i] = true;

            }

            var ch = new bool[memo.Length];
            for (int j = 2; j < memo.Length; j++)
            {
                if (ch[j]) continue;
                int cnt = 0;
                for (int i = 0; i < n; i++)
                {
                    int cur = num[i];
                    if (mm[i]) continue;
                    if (cur % j == 0) cnt++;

                }
                for (int k = j; k < memo.Length; k += j) ch[k] = true;
                ans = Math.Max(ans,cnt);
            }

            Console.WriteLine(ans);

            //Console.WriteLine();

        }

        public static int gcd(int a, int b)
        {
            if (a % b == 0) return b;
            else return gcd(b, a % b);
        }

        public static bool isPrime(int a)
        {
            for(int i = 2; i<=(int)Math.Sqrt(a); i++)
            {
                if (a % i == 0) return false;
            }
            return true;
        }
    }

    class Segment
    {
        //public int[] arr;
        public Tuple<int, int, int, int, int>[] arr;
        int n;

        public Segment(int n)
        {
            this.n = n * 2;
            //arr = Enumerable.Range(0, n*2).ToArray();
            //arr = new int[this.n];
            arr = new Tuple<int, int, int, int, int>[this.n];
            for (int i = 0; i < this.n; i++)
            {
                arr[i] = Tuple.Create(0, 0, 0, 0, 0);
            }

        }

        public void update(int i, int x)
        {
            i = (n / 2) + i - 1;
            //arr[i] = 1;
            if (x == 2) arr[i] = Tuple.Create(1, 0, 0, 0, 0);
            else if (x == 0) arr[i] = Tuple.Create(0, 1, 0, 0, 0);
            else if (x == 1) arr[i] = Tuple.Create(0, 0, 1, 0, 0);
            else if (x == 6) arr[i] = Tuple.Create(0, 0, 0, 1, 0);
            else if (x == 7) arr[i] = Tuple.Create(0, 0, 0, 0, 1);

            while (i > 0)
            {
                i = (i - 1) / 2;
                //arr[i] = Math.Max(arr[i*2+1], arr[i*2+2]);
                //if (arr[i * 2 + 1] > arr[i * 2 + 2])
                //{
                //    arr[i] = arr[i*2+1];
                //}
                //else
                //{
                //    arr[i] = arr[i*2+2];
                //}
                //arr[i] = arr[i * 2 + 1] + arr[i * 2 + 2];
                arr[i] = Tuple.Create(arr[i * 2 + 1].Item1 + arr[i * 2 + 2].Item1,
                    arr[i * 2 + 1].Item2 + arr[i * 2 + 2].Item2,
                    arr[i * 2 + 1].Item3 + arr[i * 2 + 2].Item3,
                    arr[i * 2 + 1].Item4 + arr[i * 2 + 2].Item4,
                    arr[i * 2 + 1].Item5 + arr[i * 2 + 2].Item5);
            }

        }

        //call : query(a,b, 0, 0, n)
        public Tuple<int, int, int, int, int> query(int a, int b, int k, int l, int r)
        {
            if (r <= a || b <= l) return Tuple.Create(0, 0, 0, 0, 0);
            if (a <= l && r <= b) return arr[k];
            else
            {

                var vl = query(a, b, k * 2 + 1, l, (l + r) / 2);
                var vr = query(a, b, k * 2 + 2, (l + r) / 2, r);

                //if (vl.Item4 > vr.Item4)
                //{
                //    return vl;
                //}
                ////else if (vl.Item4 == vr.Item4)
                ////{
                ////    if (countA >= countB) return vr;
                ////    else return vl;
                ////}
                //else return vr;

                return Tuple.Create(vl.Item1 + vr.Item1,
   vl.Item2 + vr.Item2,
   vl.Item3 + vr.Item3,
  vl.Item4 + vr.Item4,
   vl.Item5 + vr.Item5);

                //return Math.Max(vl, vr);
                //return vl
                int countA = 0;
                int countB = 0;
                if (vl.Item1 == 0) countA++;
                if (vl.Item2 == 0) countA++;
                if (vl.Item3 == 0) countA++;
                if (vl.Item4 == 0) countA++;
                if (vl.Item5 == 0) countA++;

                if (vr.Item1 == 0) countB++;
                if (vr.Item2 == 0) countB++;
                if (vr.Item3 == 0) countB++;
                if (vr.Item4 == 0) countB++;
                if (vr.Item5 == 0) countB++;

                if ((vl.Item1 == 0 && vr.Item1 > 0))
                {
                    return vr;
                }
                else if ((vl.Item1 > 0 && vr.Item1 == 0))
                {
                    return vl;
                }
                else if ((vl.Item2 == 0 && vr.Item2 > 0))
                {
                    return vr;
                }
                else if ((vl.Item2 > 0 && vr.Item2 == 0))
                {
                    return vl;
                }
                else if ((vl.Item3 == 0 && vr.Item3 > 0))
                {
                    return vr;
                }
                else if ((vl.Item3 > 0 && vr.Item3 == 0))
                {
                    return vl;
                }
                else if ((vl.Item4 == 0 && vr.Item4 > 0))
                {
                    return vr;
                }
                else if ((vl.Item4 > 0 && vr.Item4 == 0))
                {
                    return vl;
                }
                else if ((vl.Item5 == 0 && vr.Item5 > 0))
                {
                    return vr;
                }
                else if ((vl.Item5 > 0 && vr.Item5 == 0))
                {
                    return vl;
                }

                if (vl.Item4 > vr.Item4)
                {
                    return vl;
                }
                else if (vl.Item4 == vr.Item4)
                {
                    if (countA >= countB) return vr;
                    else return vl;
                }
                else return vr;

                //if (countA <= countB) return vl;
                //else return vr;
            }
        }

    }

    class UnionFind
    {
        public int[] path;

        public UnionFind(int n)
        {
            path = new int[n];

            for (int i = 0; i < n; i++)
            {
                path[i] = i;
            }

        }

        private int root(int i)
        {
            while (i != path[i])
            {
                path[i] = path[path[i]];
                i = path[i];
            }
            return i;
        }

        public bool find(int p, int q)
        {
            return root(p) == root(q);
        }

        public void unite(int p, int q)
        {
            int i = root(p);
            int j = root(q);
            path[i] = j;
        }

    }
}


using System;
using System.Collections.Generic;
using System.Collections;
using System.Linq;
using System.Numerics;
using System.Text;

namespace contest
{

    class contest
    {

        static void Main(string[] args)
        {

            //var num = Console.ReadLine().Split().Select(int.Parse).ToArray();
            //int n = num[0];
            //int m = num[1];

            //var input = Console.ReadLine().Split().Select(int.Parse).ToArray();

            //int n = int.Parse(Console.ReadLine());

            //var num = Console.ReadLine().Split().Select(int.Parse).ToArray();
            //for (int i = 0; i < n; i++)
            //{
            //    input[i] = Console.ReadLine().Split().Select(int.Parse).ToArray();

            //}

            //int n = int.Parse(Console.ReadLine());
            //var num = Console.ReadLine().Split().Select(int.Parse).ToArray();
            //int n = num[0];
            //int m = num[1];

            //int n = int.Parse(Console.ReadLine());
            //var num = Console.ReadLine().Split().Select(int.Parse).ToArray();

            //var arr = new int[n][];
            //for(int i =0; i< n; i++)
            //{
            //    arr[i] = Console.ReadLine().Split().Select(int.Parse).ToArray();
            //}

            int n = int.Parse(Console.ReadLine());
            var arr = Console.ReadLine().Split().Select(int.Parse).ToArray();

            Array.Sort(arr);
            //var ch = new bool[n];
            //for(int i=0; i< n; i++)
            //{
            //    int cur = arr[i];
            //    if (isPrime(cur)) ch[i] = true;
            //}

            var cntArr = new int[100001];
            for (int i=0; i< n; i++)
            {
                int cur = arr[i];
                if (cur == 1) continue;
                bool same = false;
                for(int j=2;j<=(int)Math.Sqrt(cur); j++)
                {
                    if (cur == j) same = true;
                    if (cur % j == 0) cntArr[j]++;
                }
                if(!same)cntArr[cur]++;
            }

            int mx = cntArr.Max()>0? cntArr.Max(): 1;

            //var memo = new bool[100001];
            //for (int j = 2; j <= (int)Math.Sqrt(100000); j++)
            //{
            //    if (memo[j]) continue;
            //    int cnt = 0;
            //    for (int i = 0; i < n; i++)
            //    {
            //        int cur = arr[i];
            //        if (cur==1 || cur<j) continue;
            //        if (cur % j == 0)
            //        {
            //            cnt++;

            //        }
            //    }
            //    //for (int i = j; i <= 100000; i += j) memo[i] = true;
            //    mx = Math.Max(mx, cnt);
            //}

            Console.WriteLine(mx);

            //Console.WriteLine();

            }

        public static int findPrime(int a)
        {
            //if (a == 1) return true;
            //if (a == 2) return false;
            for (int i = 2; i <= (int)Math.Sqrt(a); i++)
            {
                if (a % i == 0) return i;
            }
            return a;
        }

        //public static int gcd(int a, int b)
        //{
        //    if (a > b) gcd(b, a);
        //    if (a % b == 0) return b;
        //    return gcd(b, a % b);
        //}

    }

        class Segment
        {
            //public int[] arr;
            public Tuple<int, int, int, int, int>[] arr;
            int n;

            public Segment(int n)
            {
                this.n = n * 2;
                //arr = Enumerable.Range(0, n*2).ToArray();
                //arr = new int[this.n];
                arr = new Tuple<int, int, int, int, int>[this.n];
                for (int i = 0; i < this.n; i++)
                {
                    arr[i] = Tuple.Create(0, 0, 0, 0, 0);
                }

            }

            public void update(int i, int x)
            {
                i = (n / 2) + i - 1;
                //arr[i] = 1;
                if (x == 2) arr[i] = Tuple.Create(1, 0, 0, 0, 0);
                else if (x == 0) arr[i] = Tuple.Create(0, 1, 0, 0, 0);
                else if (x == 1) arr[i] = Tuple.Create(0, 0, 1, 0, 0);
                else if (x == 6) arr[i] = Tuple.Create(0, 0, 0, 1, 0);
                else if (x == 7) arr[i] = Tuple.Create(0, 0, 0, 0, 1);

                while (i > 0)
                {
                    i = (i - 1) / 2;
                    //arr[i] = Math.Max(arr[i*2+1], arr[i*2+2]);
                    //if (arr[i * 2 + 1] > arr[i * 2 + 2])
                    //{
                    //    arr[i] = arr[i*2+1];
                    //}
                    //else
                    //{
                    //    arr[i] = arr[i*2+2];
                    //}
                    //arr[i] = arr[i * 2 + 1] + arr[i * 2 + 2];
                    arr[i] = Tuple.Create(arr[i * 2 + 1].Item1 + arr[i * 2 + 2].Item1,
                        arr[i * 2 + 1].Item2 + arr[i * 2 + 2].Item2,
                        arr[i * 2 + 1].Item3 + arr[i * 2 + 2].Item3,
                        arr[i * 2 + 1].Item4 + arr[i * 2 + 2].Item4,
                        arr[i * 2 + 1].Item5 + arr[i * 2 + 2].Item5);
                }

            }

            //call : query(a,b, 0, 0, n)
            public Tuple<int, int, int, int, int> query(int a, int b, int k, int l, int r)
            {
                if (r <= a || b <= l) return Tuple.Create(0, 0, 0, 0, 0);
                if (a <= l && r <= b) return arr[k];
                else
                {

                    var vl = query(a, b, k * 2 + 1, l, (l + r) / 2);
                    var vr = query(a, b, k * 2 + 2, (l + r) / 2, r);

                    //if (vl.Item4 > vr.Item4)
                    //{
                    //    return vl;
                    //}
                    ////else if (vl.Item4 == vr.Item4)
                    ////{
                    ////    if (countA >= countB) return vr;
                    ////    else return vl;
                    ////}
                    //else return vr;

                    return Tuple.Create(vl.Item1 + vr.Item1,
       vl.Item2 + vr.Item2,
       vl.Item3 + vr.Item3,
      vl.Item4 + vr.Item4,
       vl.Item5 + vr.Item5);

                    //return Math.Max(vl, vr);
                    //return vl
                    int countA = 0;
                    int countB = 0;
                    if (vl.Item1 == 0) countA++;
                    if (vl.Item2 == 0) countA++;
                    if (vl.Item3 == 0) countA++;
                    if (vl.Item4 == 0) countA++;
                    if (vl.Item5 == 0) countA++;

                    if (vr.Item1 == 0) countB++;
                    if (vr.Item2 == 0) countB++;
                    if (vr.Item3 == 0) countB++;
                    if (vr.Item4 == 0) countB++;
                    if (vr.Item5 == 0) countB++;

                    if ((vl.Item1 == 0 && vr.Item1 > 0))
                    {
                        return vr;
                    }
                    else if ((vl.Item1 > 0 && vr.Item1 == 0))
                    {
                        return vl;
                    }
                    else if ((vl.Item2 == 0 && vr.Item2 > 0))
                    {
                        return vr;
                    }
                    else if ((vl.Item2 > 0 && vr.Item2 == 0))
                    {
                        return vl;
                    }
                    else if ((vl.Item3 == 0 && vr.Item3 > 0))
                    {
                        return vr;
                    }
                    else if ((vl.Item3 > 0 && vr.Item3 == 0))
                    {
                        return vl;
                    }
                    else if ((vl.Item4 == 0 && vr.Item4 > 0))
                    {
                        return vr;
                    }
                    else if ((vl.Item4 > 0 && vr.Item4 == 0))
                    {
                        return vl;
                    }
                    else if ((vl.Item5 == 0 && vr.Item5 > 0))
                    {
                        return vr;
                    }
                    else if ((vl.Item5 > 0 && vr.Item5 == 0))
                    {
                        return vl;
                    }

                    if (vl.Item4 > vr.Item4)
                    {
                        return vl;
                    }
                    else if (vl.Item4 == vr.Item4)
                    {
                        if (countA >= countB) return vr;
                        else return vl;
                    }
                    else return vr;

                    //if (countA <= countB) return vl;
                    //else return vr;
                }
            }

        }

        class UnionFind
        {
            public int[] path;

            public UnionFind(int n)
            {
                path = new int[n];

                for (int i = 0; i < n; i++)
                {
                    path[i] = i;
                }

            }

            private int root(int i)
            {
                while (i != path[i])
                {
                    path[i] = path[path[i]];
                    i = path[i];
                }
                return i;
            }

            public bool find(int p, int q)
            {
                return root(p) == root(q);
            }

            public void unite(int p, int q)
            {
                int i = root(p);
                int j = root(q);
                path[i] = j;
            }

        }
    }


using System;
using System.Collections.Generic;
using System.Collections;
using System.Linq;
using System.Numerics;
using System.Text;

namespace contest
{

    class contest
    {

        static void Main(string[] args)
        {

            //var num = Console.ReadLine().Split().Select(int.Parse).ToArray();
            //int n = num[0];
            //int m = num[1];

            //var input = Console.ReadLine().Split().Select(int.Parse).ToArray();

            //int n = int.Parse(Console.ReadLine());

            //var num = Console.ReadLine().Split().Select(int.Parse).ToArray();
            //for (int i = 0; i < n; i++)
            //{
            //    input[i] = Console.ReadLine().Split().Select(int.Parse).ToArray();

            //}

            //int n = int.Parse(Console.ReadLine());
            //var num = Console.ReadLine().Split().Select(int.Parse).ToArray();
            //int n = num[0];
            //int m = num[1];

            //int n = int.Parse(Console.ReadLine());
            //var num = Console.ReadLine().Split().Select(int.Parse).ToArray();

            //var arr = new int[n][];
            //for(int i =0; i< n; i++)
            //{
            //    arr[i] = Console.ReadLine().Split().Select(int.Parse).ToArray();
            //}

            int n = int.Parse(Console.ReadLine());
            var arr = Console.ReadLine().Split().Select(int.Parse).ToArray();

            Array.Sort(arr);
            //var ch = new bool[n];
            //for(int i=0; i< n; i++)
            //{
            //    int cur = arr[i];
            //    if (isPrime(cur)) ch[i] = true;
            //}

            int mx = 1;
            int tmp = 1;
            for (int i = 0; i < n - 1; i++)
            {
                int cur = arr[i];
                int nx = arr[i + 1];
                if (cur == 1) continue;
                if (cur == nx) tmp++;
                else
                {

                    tmp = 1;
                }

                mx = Math.Max(mx, tmp);
            }

            var memo = new bool[100001];
            for (int j = 2; j <= 100000; j++)
            {
                if (memo[j]) continue;
                int cnt = 0;
                for (int i = 0; i < n; i++)
                {
                    int cur = arr[i];
                    if (cur==1 || cur<j) continue;
                    if (cur % j == 0)
                    {
                        cnt++;

                    }
                }
                for (int i = j; i <= 100000; i += j) memo[i] = true;
                mx = Math.Max(mx, cnt);
            }
            Console.WriteLine(mx);

            //Console.WriteLine();

            }

        public static bool isPrime(int a)
        {
            if (a == 1) return true;
            if (a == 2) return false;
            for (int i = 2; i <= (int)Math.Sqrt(a); i++)
            {
                if (a % i == 0) return false;
            }
            return true;
        }

        //public static int gcd(int a, int b)
        //{
        //    if (a > b) gcd(b, a);
        //    if (a % b == 0) return b;
        //    return gcd(b, a % b);
        //}

    }

        class Segment
        {
            //public int[] arr;
            public Tuple<int, int, int, int, int>[] arr;
            int n;

            public Segment(int n)
            {
                this.n = n * 2;
                //arr = Enumerable.Range(0, n*2).ToArray();
                //arr = new int[this.n];
                arr = new Tuple<int, int, int, int, int>[this.n];
                for (int i = 0; i < this.n; i++)
                {
                    arr[i] = Tuple.Create(0, 0, 0, 0, 0);
                }

            }

            public void update(int i, int x)
            {
                i = (n / 2) + i - 1;
                //arr[i] = 1;
                if (x == 2) arr[i] = Tuple.Create(1, 0, 0, 0, 0);
                else if (x == 0) arr[i] = Tuple.Create(0, 1, 0, 0, 0);
                else if (x == 1) arr[i] = Tuple.Create(0, 0, 1, 0, 0);
                else if (x == 6) arr[i] = Tuple.Create(0, 0, 0, 1, 0);
                else if (x == 7) arr[i] = Tuple.Create(0, 0, 0, 0, 1);

                while (i > 0)
                {
                    i = (i - 1) / 2;
                    //arr[i] = Math.Max(arr[i*2+1], arr[i*2+2]);
                    //if (arr[i * 2 + 1] > arr[i * 2 + 2])
                    //{
                    //    arr[i] = arr[i*2+1];
                    //}
                    //else
                    //{
                    //    arr[i] = arr[i*2+2];
                    //}
                    //arr[i] = arr[i * 2 + 1] + arr[i * 2 + 2];
                    arr[i] = Tuple.Create(arr[i * 2 + 1].Item1 + arr[i * 2 + 2].Item1,
                        arr[i * 2 + 1].Item2 + arr[i * 2 + 2].Item2,
                        arr[i * 2 + 1].Item3 + arr[i * 2 + 2].Item3,
                        arr[i * 2 + 1].Item4 + arr[i * 2 + 2].Item4,
                        arr[i * 2 + 1].Item5 + arr[i * 2 + 2].Item5);
                }

            }

            //call : query(a,b, 0, 0, n)
            public Tuple<int, int, int, int, int> query(int a, int b, int k, int l, int r)
            {
                if (r <= a || b <= l) return Tuple.Create(0, 0, 0, 0, 0);
                if (a <= l && r <= b) return arr[k];
                else
                {

                    var vl = query(a, b, k * 2 + 1, l, (l + r) / 2);
                    var vr = query(a, b, k * 2 + 2, (l + r) / 2, r);

                    //if (vl.Item4 > vr.Item4)
                    //{
                    //    return vl;
                    //}
                    ////else if (vl.Item4 == vr.Item4)
                    ////{
                    ////    if (countA >= countB) return vr;
                    ////    else return vl;
                    ////}
                    //else return vr;

                    return Tuple.Create(vl.Item1 + vr.Item1,
       vl.Item2 + vr.Item2,
       vl.Item3 + vr.Item3,
      vl.Item4 + vr.Item4,
       vl.Item5 + vr.Item5);

                    //return Math.Max(vl, vr);
                    //return vl
                    int countA = 0;
                    int countB = 0;
                    if (vl.Item1 == 0) countA++;
                    if (vl.Item2 == 0) countA++;
                    if (vl.Item3 == 0) countA++;
                    if (vl.Item4 == 0) countA++;
                    if (vl.Item5 == 0) countA++;

                    if (vr.Item1 == 0) countB++;
                    if (vr.Item2 == 0) countB++;
                    if (vr.Item3 == 0) countB++;
                    if (vr.Item4 == 0) countB++;
                    if (vr.Item5 == 0) countB++;

                    if ((vl.Item1 == 0 && vr.Item1 > 0))
                    {
                        return vr;
                    }
                    else if ((vl.Item1 > 0 && vr.Item1 == 0))
                    {
                        return vl;
                    }
                    else if ((vl.Item2 == 0 && vr.Item2 > 0))
                    {
                        return vr;
                    }
                    else if ((vl.Item2 > 0 && vr.Item2 == 0))
                    {
                        return vl;
                    }
                    else if ((vl.Item3 == 0 && vr.Item3 > 0))
                    {
                        return vr;
                    }
                    else if ((vl.Item3 > 0 && vr.Item3 == 0))
                    {
                        return vl;
                    }
                    else if ((vl.Item4 == 0 && vr.Item4 > 0))
                    {
                        return vr;
                    }
                    else if ((vl.Item4 > 0 && vr.Item4 == 0))
                    {
                        return vl;
                    }
                    else if ((vl.Item5 == 0 && vr.Item5 > 0))
                    {
                        return vr;
                    }
                    else if ((vl.Item5 > 0 && vr.Item5 == 0))
                    {
                        return vl;
                    }

                    if (vl.Item4 > vr.Item4)
                    {
                        return vl;
                    }
                    else if (vl.Item4 == vr.Item4)
                    {
                        if (countA >= countB) return vr;
                        else return vl;
                    }
                    else return vr;

                    //if (countA <= countB) return vl;
                    //else return vr;
                }
            }

        }

        class UnionFind
        {
            public int[] path;

            public UnionFind(int n)
            {
                path = new int[n];

                for (int i = 0; i < n; i++)
                {
                    path[i] = i;
                }

            }

            private int root(int i)
            {
                while (i != path[i])
                {
                    path[i] = path[path[i]];
                    i = path[i];
                }
                return i;
            }

            public bool find(int p, int q)
            {
                return root(p) == root(q);
            }

            public void unite(int p, int q)
            {
                int i = root(p);
                int j = root(q);
                path[i] = j;
            }

        }
    }


using System;
using System.Collections.Generic;
using System.Collections;
using System.Linq;
using System.Numerics;
using System.Text;

namespace contest
{

    class contest
    {

        static void Main(string[] args)
        {

            //var num = Console.ReadLine().Split().Select(int.Parse).ToArray();
            //int n = num[0];
            //int m = num[1];

            //var input = Console.ReadLine().Split().Select(int.Parse).ToArray();

            //int n = int.Parse(Console.ReadLine());

            //var num = Console.ReadLine().Split().Select(int.Parse).ToArray();
            //for (int i = 0; i < n; i++)
            //{
            //    input[i] = Console.ReadLine().Split().Select(int.Parse).ToArray();

            //}

            //int n = int.Parse(Console.ReadLine());
            //var num = Console.ReadLine().Split().Select(int.Parse).ToArray();
            //int n = num[0];
            //int m = num[1];

            //int n = int.Parse(Console.ReadLine());
            //var num = Console.ReadLine().Split().Select(int.Parse).ToArray();

            //var arr = new int[n][];
            //for(int i =0; i< n; i++)
            //{
            //    arr[i] = Console.ReadLine().Split().Select(int.Parse).ToArray();
            //}

            int n = int.Parse(Console.ReadLine());
            var arr = Console.ReadLine().Split().Select(int.Parse).ToArray();

            Array.Sort(arr);
            //var ch = new bool[n];
            //for(int i=0; i< n; i++)
            //{
            //    int cur = arr[i];
            //    if (isPrime(cur)) ch[i] = true;
            //}

            //var mm = new bool[n];
            //ch.CopyTo(mm,0);
            //int mx = 1;
            //for (int i = 0; i < n; i++)
            //{
            //    if (!mm[i]) continue;
            //    int cur = arr[i];
            //    int cnt = 1;
            //    for(int j= i+1; j< n; j++)
            //    {
            //        if (mm[i]) continue;
            //        if (arr[j] % cur == 0)
            //        {
            //            cnt++;
            //            mm[j] = true;
            //        }
            //    }
            //    mx = Math.Max(mx, cnt);
            //}

            int mx = 1;
            int tmp = 1;
            for (int i = 0; i < n - 1; i++)
            {
                int cur = arr[i];
                int nx = arr[i + 1];
                if (cur == nx) tmp++;
                else
                {

                    tmp = 1;
                }

                mx = Math.Max(mx, tmp);
            }

            var memo = new bool[100001];
            for (int j = 2; j <= (int)Math.Sqrt(100000); j++)
            {
                //if (memo[j]) continue;
                int cnt = 0;
                for (int i = 0; i < n; i++)
                {
                    int cur = arr[i];
                    if (cur==1 ) continue;
                    if (cur % j == 0)
                    {
                        cnt++;
                        //memo[i]=true;
                    }
                }
                //for (int i = j; i <= 100000; i += j) memo[i] = true;
                mx = Math.Max(mx, cnt);
            }
            Console.WriteLine(mx);

            //Console.WriteLine();

            }

        public static bool isPrime(int a)
        {
            if (a == 1) return true;
            if (a == 2) return false;
            for (int i = 2; i <= (int)Math.Sqrt(a); i++)
            {
                if (a % i == 0) return false;
            }
            return true;
        }

        //public static int gcd(int a, int b)
        //{
        //    if (a > b) gcd(b, a);
        //    if (a % b == 0) return b;
        //    return gcd(b, a % b);
        //}

    }

        class Segment
        {
            //public int[] arr;
            public Tuple<int, int, int, int, int>[] arr;
            int n;

            public Segment(int n)
            {
                this.n = n * 2;
                //arr = Enumerable.Range(0, n*2).ToArray();
                //arr = new int[this.n];
                arr = new Tuple<int, int, int, int, int>[this.n];
                for (int i = 0; i < this.n; i++)
                {
                    arr[i] = Tuple.Create(0, 0, 0, 0, 0);
                }

            }

            public void update(int i, int x)
            {
                i = (n / 2) + i - 1;
                //arr[i] = 1;
                if (x == 2) arr[i] = Tuple.Create(1, 0, 0, 0, 0);
                else if (x == 0) arr[i] = Tuple.Create(0, 1, 0, 0, 0);
                else if (x == 1) arr[i] = Tuple.Create(0, 0, 1, 0, 0);
                else if (x == 6) arr[i] = Tuple.Create(0, 0, 0, 1, 0);
                else if (x == 7) arr[i] = Tuple.Create(0, 0, 0, 0, 1);

                while (i > 0)
                {
                    i = (i - 1) / 2;
                    //arr[i] = Math.Max(arr[i*2+1], arr[i*2+2]);
                    //if (arr[i * 2 + 1] > arr[i * 2 + 2])
                    //{
                    //    arr[i] = arr[i*2+1];
                    //}
                    //else
                    //{
                    //    arr[i] = arr[i*2+2];
                    //}
                    //arr[i] = arr[i * 2 + 1] + arr[i * 2 + 2];
                    arr[i] = Tuple.Create(arr[i * 2 + 1].Item1 + arr[i * 2 + 2].Item1,
                        arr[i * 2 + 1].Item2 + arr[i * 2 + 2].Item2,
                        arr[i * 2 + 1].Item3 + arr[i * 2 + 2].Item3,
                        arr[i * 2 + 1].Item4 + arr[i * 2 + 2].Item4,
                        arr[i * 2 + 1].Item5 + arr[i * 2 + 2].Item5);
                }

            }

            //call : query(a,b, 0, 0, n)
            public Tuple<int, int, int, int, int> query(int a, int b, int k, int l, int r)
            {
                if (r <= a || b <= l) return Tuple.Create(0, 0, 0, 0, 0);
                if (a <= l && r <= b) return arr[k];
                else
                {

                    var vl = query(a, b, k * 2 + 1, l, (l + r) / 2);
                    var vr = query(a, b, k * 2 + 2, (l + r) / 2, r);

                    //if (vl.Item4 > vr.Item4)
                    //{
                    //    return vl;
                    //}
                    ////else if (vl.Item4 == vr.Item4)
                    ////{
                    ////    if (countA >= countB) return vr;
                    ////    else return vl;
                    ////}
                    //else return vr;

                    return Tuple.Create(vl.Item1 + vr.Item1,
       vl.Item2 + vr.Item2,
       vl.Item3 + vr.Item3,
      vl.Item4 + vr.Item4,
       vl.Item5 + vr.Item5);

                    //return Math.Max(vl, vr);
                    //return vl
                    int countA = 0;
                    int countB = 0;
                    if (vl.Item1 == 0) countA++;
                    if (vl.Item2 == 0) countA++;
                    if (vl.Item3 == 0) countA++;
                    if (vl.Item4 == 0) countA++;
                    if (vl.Item5 == 0) countA++;

                    if (vr.Item1 == 0) countB++;
                    if (vr.Item2 == 0) countB++;
                    if (vr.Item3 == 0) countB++;
                    if (vr.Item4 == 0) countB++;
                    if (vr.Item5 == 0) countB++;

                    if ((vl.Item1 == 0 && vr.Item1 > 0))
                    {
                        return vr;
                    }
                    else if ((vl.Item1 > 0 && vr.Item1 == 0))
                    {
                        return vl;
                    }
                    else if ((vl.Item2 == 0 && vr.Item2 > 0))
                    {
                        return vr;
                    }
                    else if ((vl.Item2 > 0 && vr.Item2 == 0))
                    {
                        return vl;
                    }
                    else if ((vl.Item3 == 0 && vr.Item3 > 0))
                    {
                        return vr;
                    }
                    else if ((vl.Item3 > 0 && vr.Item3 == 0))
                    {
                        return vl;
                    }
                    else if ((vl.Item4 == 0 && vr.Item4 > 0))
                    {
                        return vr;
                    }
                    else if ((vl.Item4 > 0 && vr.Item4 == 0))
                    {
                        return vl;
                    }
                    else if ((vl.Item5 == 0 && vr.Item5 > 0))
                    {
                        return vr;
                    }
                    else if ((vl.Item5 > 0 && vr.Item5 == 0))
                    {
                        return vl;
                    }

                    if (vl.Item4 > vr.Item4)
                    {
                        return vl;
                    }
                    else if (vl.Item4 == vr.Item4)
                    {
                        if (countA >= countB) return vr;
                        else return vl;
                    }
                    else return vr;

                    //if (countA <= countB) return vl;
                    //else return vr;
                }
            }

        }

        class UnionFind
        {
            public int[] path;

            public UnionFind(int n)
            {
                path = new int[n];

                for (int i = 0; i < n; i++)
                {
                    path[i] = i;
                }

            }

            private int root(int i)
            {
                while (i != path[i])
                {
                    path[i] = path[path[i]];
                    i = path[i];
                }
                return i;
            }

            public bool find(int p, int q)
            {
                return root(p) == root(q);
            }

            public void unite(int p, int q)
            {
                int i = root(p);
                int j = root(q);
                path[i] = j;
            }

        }
    }