#include <bits/stdc++.h>
using namespace std;

using ll = long long;

#define pb push_back
#define ff first
#define ss second
#define all(a) a.begin(), a.end()
#define sz(a) (int)(a.size())
#define clr(a, b) memset(a, b, sizeof(a))
#define REP(i, a, b) for(int i=(int)(a); i<(int)(b); ++i)
#define REPD(i, a, b) for(int i=(int)(a)-1; i>=(int)(b); --i)

template<typename T> inline bool chkmin(T &a, const T &b) { return a > b ? a = b, 1 : 0; }
template<typename T> inline bool chkmax(T &a, const T &b) { return a < b ? a = b, 1 : 0; }

mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());

const ll MX = 1e18;
ll N;

int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cin >> N;
    ll i3 = 3;
    REP(i, 1, 50) {
    	ll j5 = 5;
    	REP(j, 1, 50) {
    		if(i3 > MX) break;
    		if(j5 > MX) break;
    		if(i3 + j5 == N) {
    			cout << i << " " << j << "\n";
    			return 0;
    		}
    		j5 *= 5;
    	}
    	i3 *= 3;
    }
    cout << -1 <<"\n";
    return 0;
}

#include <bits/stdc++.h>
#define ld long double
#define endl "\n"
#define fastio ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define pb push_back
#define mp(a,b) make_pair(a,b)
#define ms(v,x) memset(v,x,sizeof(v))
#define all(v) v.begin(),v.end()
#define ff first
#define ss second
#define rep(i, a, b) for(int i = a; i < (b); ++i)
#define per(i, a, b) for(int i = b-1; i>=a ; i--)
#define trav(a, x) for(auto& a : x)
#define allin(a , x) for(auto a : x)
#define Unique(v) sort(all(v));v.erase(unique(all(v)),v.end());
#define sz(v) ((int)v.size())
//#define int long long  
using namespace std;
typedef vector<int> vi;
#define y1 abacaba
//#define left oooooopss
#define db(x) cerr << #x <<" == "<<x << endl;
#define db2(x,y) cerr<<#x <<" == "<<x<<", "<<#y<<" == "<<y<<endl;
#define db3(x,y,z) cerr << #x<<" == "<<x<<", "<<#y<<" == "<<y<<", "<<#z<<" == "<<z<<endl;
typedef long long ll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
std::mt19937 rng((int) std::chrono::steady_clock::now().time_since_epoch().count());
inline ll mod(ll n, ll m ){ ll ret = n%m; if(ret < 0) ret += m; return ret; }
//ll gcd(ll a, ll b){return (b == 0LL ? a : gcd(b, a%b));}
int gcd(int a,int b){
  return (b==0 ? a : gcd(b,a%b));
}
ll exp(ll b,ll e,ll m){
  b%=m;
  ll ans = 1;
  for (; e; b = b * b % m, e /= 2)
      if (e & 1) ans = ans * b % m;
  return ans;
}
const int N = 2020;
int A[N];

map<int,vi> here;

int32_t main(){
  fastio;
  int n;
  cin >> n;
  
  int mn = 2e9 + 7;
  for(int i=1;i<=n;i++){
    cin >> A[i];
    mn=min(mn,A[i]);
  }
  for(int i=1;i<=n;i++){

    for(int x=1;x*x<=A[i];x++){
      if(A[i]%x==0){
        if(x<=mn)here[x].pb(A[i]);
        if((A[i]/x)!=x and (A[i]/x)<=mn)here[A[i]/x].pb(A[i]);
      }
    }

  }

  int res=0;
  for(auto it : here){
    int g = it.ss[0];
    for(auto x : it.ss)g = gcd(g,x);
    if(g!=it.ff)continue;
   // cout << it.ff << endl;
    res++;
  }
  cout << res << endl;
  
  // math -> gcd it all
  // Did u check N=1? Did you switch N,M?
}