#pragma GCC optimize("Ofast")
#pragma GCC target("avx,avx2,fma")
#include<bits/stdc++.h>
using namespace std;
#define hackcyborg shresth_walia
#define all(a) a.begin(), a.end()
#define ll long long
#define ld long double
#define pb push_back
#define mod 1000000007
#define IO ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
#define ordered_set tree<int,null_type,less<int>, rb_tree_tag,tree_order_statistics_node_update>
#define rep(i, a, b) for(int i = a; i < (b); ++i)
#define sz(x) (int)(x).size()
typedef pair<int, int> pii;
typedef vector<int> vi;
ll bp(ll a,ll b,int Mod=mod)
{
    ll res=1;
    a%=Mod;
    while(b>0)
    {
        if(b&1)
        res=(a*res)%Mod;
        a=(a*a)%Mod;
        b/=2;
    }
    return res;
}
main()
{
   IO
   int n;
   cin>>n;
   int a[n];
   int g=1e18;
   for(int x=0;x<n;x++)
     {cin>>a[x];
     g=min(g,a[x]);}
   set<int> as;
   as.insert(1);
   for(int x=0;x<n;x++)
    {
        int h=sqrt(a[x]);
        for(int y=2;y<=h;y++)
        {
            if(a[x]%y==0)
            {
                as.insert(y);
                if(a[x]/y!=y)
                as.insert(a[x]/y);
            }
        }
    }
   int f=0;
   for(auto i : as)
   {   if(i>g)break;
      int w=0;
   	   for(int x=0;x<n;x++)
   	   {
   	   	  if(a[x]%i==0)
   	   	    {w=__gcd(w,a[x]);
   	   	    if(w<i)break;}
   	   }
   	   if(w==i)++f;
   }
   if(!as.count(g))++f;
   cout<<f;
}

#include <bits/stdc++.h>

using namespace std;

const int mod = 1000000007;
#define ARRAY_LENGTH(array) (sizeof(array) / sizeof(array[0]))
#define rep(i,n) for (int i = 0; i < (n); i++)
#define repd(i,n) for(int i = n-1; i >= 0; i--)
#define ll long long
#define P pair<int, int>

#define INF32 2147483647 //2.147483647×10^{9}:32bit整数のinf
#define INF64 9223372036854775807 //9.223372036854775807×10^{18}:64bit整数のinf

// debug methods
// usage: debug(x,y);
#define CHOOSE(a) CHOOSE2 a
#define CHOOSE2(a0,a1,a2,a3,a4,x,...) x
#define debug_1(x1) cout<<#x1<<": "<<x1<<endl
#define debug_2(x1,x2) cout<<#x1<<": "<<x1<<", "#x2<<": "<<x2<<endl
#define debug_3(x1,x2,x3) cout<<#x1<<": "<<x1<<", "#x2<<": "<<x2<<", "#x3<<": "<<x3<<endl
#define debug_4(x1,x2,x3,x4) cout<<#x1<<": "<<x1<<", "#x2<<": "<<x2<<", "#x3<<": "<<x3<<", "#x4<<": "<<x4<<endl
#define debug_5(x1,x2,x3,x4,x5) cout<<#x1<<": "<<x1<<", "#x2<<": "<<x2<<", "#x3<<": "<<x3<<", "#x4<<": "<<x4<<", "#x5<<": "<<x5<<endl
#ifdef _DEBUG
#define debug(...) CHOOSE((__VA_ARGS__,debug_5,debug_4,debug_3,debug_2,debug_1,~))(__VA_ARGS__)
#else
#define debug(...)
#endif

const double PI = acos(-1);

unsigned GetDigit(unsigned num) { return log10(num)+1; }
void chmin(int& a, int b){ if (a > b) a = b; }
void chmax(int& a, int b){ if (a < b) a = b; }
void chmin(double& a, double b){ if (a > b) a = b; }
void chmax(double& a, double b){ if (a < b) a = b; }

int main()
{
	int n;
	cin >> n;

	vector<string> s(n);
	vector<int> t(n);
	rep(i, n) cin >> s[i] >> t[i];

	map<int, string> m;
	rep(i, n) m.insert(make_pair(t[i], s[i]));

	sort(t.begin(), t.end(), greater<int>());

	cout << m.at(t[1]) << endl;

	return 0;
}