#include <iostream>
#include <string>
#include <stdio.h>
#include <stdlib.h>
#include <vector>
using namespace std;
vector<string> route;
void levenshtein(string x,string y)
{
    int n = x.size();
    int m = y.size();
    vector<vector<int> > dp(n + 1,vector<int>(m + 1));
    vector<vector<char> > path(n + 1,vector<char>(m + 1));
    for(int i = 0; i <= n; i++)
    {
        dp[i][0] = i;
        path[i][0] = 'D';
    }
    for(int i = 0; i <= m; i++)
    {
        dp[0][i] = i;
        path[0][i] = 'I';
    }
    for(int i = 1; i <= n; i++)
    {
        for(int j = 1; j <= m; j++)
        {
            int cost = x[i - 1] != y[j - 1];
            path[i][j] = cost ? 'R' : 'M';
            dp[i][j] = 1000000;
            dp[i][j] = dp[i-1][j-1] + cost;
            if(dp[i][j - 1] + 1 < dp[i][j])
            {
                dp[i][j] = dp[i][j - 1] + 1;
                path[i][j] = 'I';
            }
            if (dp[i - 1][j] + 1 < dp[i][j])
            {
                dp[i][j] = dp[i - 1][j] + 1;
                path[i][j] = 'D';
            }
        }
    }
    int k = dp[n][m];
    printf("%d\n",k);
    int i = n;
    int j = m;
while(k>0)
            {

                if(j>0 && dp[i][j]==dp[i][j-1]+1)
                {
                    cout<<"INSERT"<<" "<<i+1<<" "<<y[j-1]<<endl;
                    k--;j--;

                }else

                    if(i>0 && dp[i][j]==dp[i-1][j]+1)
                    {
                        cout<<"DELETE "<<i<<" "<<endl;
                        k--;i--;
                    }else
                        if(i>0 && j>0 && dp[i][j]==dp[i-1][j-1]+1)
                        {
                            cout<<"REPLACE "<<" "<<i<<" "<<y[j-1]<<endl;
                            i--;j--;k--;
                        }
                        else
                        {
                            i--;j--;
                        }
            }
}
int main()
{
    //freopen("input.txt","r",stdin);
    //freopen("testData.txt","w",stdout);
    string s1,s2;
    cin >> s1 >> s2;
    levenshtein(s1,s2);

    return 0;
}


#include <stdio.h>
#include <string.h>
#include <algorithm>

using namespace std;
int lenA,lenB;
char A[1001],B[1001];
int  dp[1001][1001];
bool vis[1001][1001];

int calc(int i,int j)
{
    if(i==lenA && j==lenB)
        return 0;
    if(!vis[i][j])
	{
        vis[i][j]=true;
        dp[i][j]=1024;
        if(i<lenA && j<lenB)
		{
            if(A[i]==B[j])
                dp[i][j]=min(dp[i][j],calc(i+1,j+1));
            else
			{
                dp[i][j]=min(dp[i][j],1+calc(i+1,j+1));
                dp[i][j]=min(dp[i][j],1+calc(i,j+1));
                dp[i][j]=min(dp[i][j],1+calc(i+1,j));
            }
        }
        else if(i<lenA)
            dp[i][j]=min(dp[i][j],1+calc(i+1,j));
        else
            dp[i][j]=min(dp[i][j],1+calc(i,j+1));
    }
    return dp[i][j];
}
void print(int i,int j,int h)
{
    if(i==lenA && j==lenB)
        return;
    if(i<lenA && j<lenB)
	{
        if(A[i]==B[j] && dp[i][j]==calc(i+1,j+1))
            print(i+1,j+1,h);
        else if(dp[i][j]==1+calc(i+1,j+1))
		{
            printf("REPLACE %d %c\n",i+h,B[j]);
            print(i+1,j+1,h);
        }
        else if(dp[i][j]==1+calc(i,j+1))
		{
            printf("INSERT %d %c\n",i+h,B[j]);
            print(i,j+1,h+1);
        }
        else
		{
            printf("DELETE %d\n",i+h);
            print(i+1,j,h-1);
        }
    }
    else if(i<lenA)
	{
        printf("DELETE %d\n",i+h);
        print(i+1,j,h-1);
    }
    else
	{
        printf("INSERT %d %c\n",i+h,B[j]);
        print(i,j+1,h+1);
    }
}
int main()
{
    gets(A);
    gets(B);
    lenA=strlen(A);
    lenB=strlen(B);
    printf("%d\n",calc(0,0));
    print(0,0,1);
    return 0;
}


#include <iostream>
#include <iomanip>
#include <algorithm>
#include <vector>
#include <string>
#include <cmath>
#include <sstream>
#include <queue>
#include <stack>
#include <deque>
#include <set>
#include <map>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <ctime>
//#include "bigint\BigIntegerLibrary.hh"

#define oo 1000000000

using namespace std;

pair<int, int> par[1100][1100];
int dp[1100][1100];
string s1, s2;

int solve(int a, int b)
{
        if (dp[a][b] != -1)
			return dp[a][b];
        int& rr = (dp[a][b] = oo);
        if (a == 0 && b == 0)
                return (rr = 0);
        if (a > 0 && b > 0)
        {
                par[a][b] = make_pair(a - 1, b - 1);
                rr = solve(a - 1, b - 1) + (s1[a] != s2[b]);
        }
        if (a > 0 && rr > solve(a - 1, b) + 1)
        {
                par[a][b] = make_pair(a - 1, b);
				rr = solve(a - 1, b) + 1;
        }
        if (b > 0 && rr > solve(a, b - 1) + 1)
        {
                par[a][b] = make_pair(a, b - 1);
				rr = solve(a, b - 1) + 1;
        }
        return rr;
}

void op(int a, int b)
{
        if (a == 0 && b == 0)
            return;
		int c = par[a][b].first, d = par[a][b].second;
		if (c == a - 1 && d == b - 1)
			if (s1[a] != s2[b])
				cout << "REPLACE " << a << ' ' << s2[b] << endl;
		if (c == a - 1 && d == b)
			cout << "DELETE " << a << endl;
		if (c == a && d == b - 1)
			cout << "INSERT " << a + 1 << ' ' << s2[b] << endl;
        op(par[a][b].first, par[a][b].second);
}

int main()
{
        cin >> s1 >> s2;
        memset(dp, -1, sizeof(dp));
		s1.insert(s1.begin(), ' ');
		s2.insert(s2.begin(), ' ');
        cout <<solve(s1.size(), s2.size()) << endl;
        op(s1.size(), s2.size());
        return 0;
}


#include <iostream>
#include <iomanip>
#include <algorithm>
#include <vector>
#include <string>
#include <cmath>
#include <sstream>
#include <queue>
#include <stack>
#include <deque>
#include <set>
#include <map>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <ctime>
//#include "bigint\BigIntegerLibrary.hh"

#define oo 1000000000

using namespace std;

struct pp
{
	int pos;
	string type;
	char w;
};

pp tr[1100][1100];
pair<int, int> par[1100][1100];
int dp[1100][1100];
string s1, s2;

int solve(int a, int b)
{
	pp dd;
	if (dp[a][b] != -1)
		return dp[a][b];
	int rr = oo;
	if (a == 0 && b == 0)
	{
		dd.type = "REPLACE";
		dd.pos = a;
		dd.w = s2[b];
		rr = 1;
		if (s1[a] == s2[b])
		{
			dd.type = "NONE";
			rr = 0;
		}
		tr[a][b] = dd;
		return (dp[a][b] = rr);
	}
	//if (a == 0)
	//	return (dp[a][b] = b);
	//if (b == 0)
	//	return (dp[a][b] = a);
	if (a > 0 && b > 0)
	{
		dd.type = "REPLACE";
		dd.pos = a;
		dd.w = s2[b];
		par[a][b] = make_pair(a - 1, b - 1);
		if (s1[a] == s2[b])
			dd.type = "NONE";
		rr = solve(a - 1, b - 1) + (s1[a] != s2[b]);
	}
	if (a > 0 && rr > solve(a - 1, b) + 1)
	{
		rr = solve(a - 1, b) + 1;
		dd.type = "DELETE";
		dd.pos = a;
		par[a][b] = make_pair(a - 1, b);
	}
	if (b > 0 && rr > solve(a, b - 1) + 1)
	{
		rr = solve(a, b - 1) + 1;
		dd.type = "INSERT";
		dd.pos = a + 1;
		dd.w = s2[b];
		par[a][b] = make_pair(a, b - 1);
	}
	dp[a][b] = rr;
	tr[a][b] = dd;
	return rr;
}

void op(int a, int b)
{
	if (tr[a][b].type != "NONE")
	{
		cout << tr[a][b].type << ' ' << tr[a][b].pos + 1;
		if (tr[a][b].type != "DELETE")
			cout << ' ' << tr[a][b].w;
		cout << endl;
	}
	if (a == 0 && b == 0)
		return;
	op(par[a][b].first, par[a][b].second);
}

int main()
{
	cin >> s1 >> s2;
	memset(dp, -1, sizeof(dp));
	tr[0][0].pos = -1;
	cout <<solve(s1.size() - 1, s2.size() - 1) << endl;
	op(s1.size() - 1, s2.size() - 1);
	return 0;
}


// I love natalia

#include <iostream>
#include <cstdio>
#include <string>

using namespace std;

#define mp make_pair
#define pb push_back

string s;
string t;

pair <int, char>  tab[1010][1010];
bool              was[1010][1010];

int f(int s_pos = 0, int t_pos = 0) {
    if (         was[s_pos][t_pos] )
        return ( tab[s_pos][t_pos].first );

    pair <int, char> res;

    if (         s.length() == s_pos ) {
        res = mp(t.length() -  t_pos, 'I');             // INSERT
        goto exit;
    }

    if (         t.length() == t_pos ) {
        res = mp(s.length() -  s_pos, 'D');             // DELETE
        goto exit;
    }

    if (         s[s_pos] == t[t_pos] ) {
        res = mp(f(s_pos + 1,  t_pos + 1), 'S');        // SKIP
        goto exit;
    }

    res =  min(mp(f(s_pos + 1,  t_pos + 1) + 1, 'R'),   // REPLACE
           min(mp(f(s_pos,      t_pos + 1) + 1, 'I'),   // INSERT
               mp(f(s_pos + 1,  t_pos    ) + 1, 'D'))); // DELETE

exit:
    tab[s_pos][t_pos] = res;
    was[s_pos][t_pos] = true;

    return ( res.first );
}

int d = 0;

void doMagic(int s_pos = 0, int t_pos = 0) {
    if ( s.length() == s_pos ) {
        for (int i = t_pos; i < t.length(); i++)
            cout << "INSERT " << i+d+1 << " " << t[i] << endl;

        goto exit;
    }

    if (         t.length() == t_pos ) {
        for (int i = s_pos; i < s.length(); i++)
            cout << "DELETE " << s_pos+d+1 << endl;

        goto exit;
    }

    if ( s[s_pos] == t[t_pos] ) {
        doMagic( s_pos + 1,  t_pos + 1);
        goto exit;
    }

    switch ( tab[s_pos][t_pos].second ) {
        case 'R':
            cout << "REPLACE " << s_pos+d+1 << " " << t[t_pos] << endl;
            doMagic(s_pos + 1,  t_pos + 1);
            break;

        case 'I':
            cout << "INSERT "  << s_pos+d+1 << " " << t[t_pos] << endl;
            d++;
            doMagic(s_pos,      t_pos + 1);
            break;

        case 'D':
            cout << "DELETE " << s_pos+d+1 << endl;
            doMagic(s_pos + 1,  t_pos    );
            break;
    }

exit:;
}

int main() {
#ifndef ONLINE_JUDGE
    freopen("input.txt", "rt", stdin);
#endif

    cin >> s >> t;

    int res = f();

    cout << res << endl;

    doMagic();

exit:
    return ( 0 );
}


// I love natalia

#include <iostream>
#include <cstdio>
#include <string>

using namespace std;

#define mp make_pair
#define pb push_back

string s;
string t;

pair <int, char>  tab[1010][1010];
bool              was[1010][1010];

int f(int s_pos = 0, int t_pos = 0) {
    if (         was[s_pos][t_pos] )
        return ( tab[s_pos][t_pos].first );

    pair <int, char> res;

    if (         s.length() == s_pos ) {
        res = mp(t.length() -  t_pos, 'I');             // INSERT
        goto exit;
    }

    if (         t.length() == t_pos ) {
        res = mp(s.length() -  s_pos, 'D');             // DELETE
        goto exit;
    }

    if (         s[s_pos] == t[t_pos] ) {
        res = mp(f(s_pos + 1,  t_pos + 1), 'S');        // SKIP
        goto exit;
    }

    res =  min(mp(f(s_pos + 1,  t_pos + 1) + 1, 'R'),   // REPLACE
           min(mp(f(s_pos,      t_pos + 1) + 1, 'I'),   // INSERT
               mp(f(s_pos + 1,  t_pos    ) + 1, 'D'))); // DELETE

exit:
    tab[s_pos][t_pos] = res;
    was[s_pos][t_pos] = true;

    return ( res.first );
}

int d = 0;

void doMagic(int s_pos = 0, int t_pos = 0) {
    if ( s.length() == s_pos ) {
        for (int i = t_pos; i < t.length(); i++)
            cout << "INSERT " << s_pos+(t.length()-i)+d+1 << " " << t[i] << endl;

        goto exit;
    }

    if (         t.length() == t_pos ) {
        for (int i = s_pos; i < s.length(); i++)
            cout << "DELETE " << s_pos+d+1 << endl;

        goto exit;
    }

    if ( s[s_pos] == t[t_pos] ) {
        doMagic( s_pos + 1,  t_pos + 1);
        goto exit;
    }

    switch ( tab[s_pos][t_pos].second ) {
        case 'R':
            cout << "REPLACE " << s_pos+d+1 << " " << t[t_pos] << endl;
            doMagic(s_pos + 1,  t_pos + 1);
            break;

        case 'I':
            cout << "INSERT "  << s_pos+d+1 << " " << t[t_pos] << endl;
            d++;
            doMagic(s_pos,      t_pos + 1);
            break;

        case 'D':
            cout << "DELETE " << s_pos+d+1 << endl;
            d--;
            doMagic(s_pos + 1,  t_pos    );
            break;
    }

exit:;
}

int main() {
#ifndef ONLINE_JUDGE
    freopen("input.txt", "rt", stdin);
#endif

    cin >> s >> t;

    int res = f();

    cout << res << endl;

    doMagic();

exit:
    return ( 0 );
}


// I love natalia

#include <iostream>
#include <cstdio>
#include <string>

using namespace std;

#define mp make_pair
#define pb push_back

string s;
string t;

pair <int, char>  tab[1010][1010];
bool              was[1010][1010];

int f(int s_pos = 0, int t_pos = 0) {
    if (         was[s_pos][t_pos] )
        return ( tab[s_pos][t_pos].first );

    pair <int, char> res;

    if (         s.length() == s_pos ) {
        res = mp(t.length() -  t_pos, 'I');             // INSERT
        goto exit;
    }

    if (         t.length() == t_pos ) {
        res = mp(s.length() -  s_pos, 'D');             // DELETE
        goto exit;
    }

    if (         s[s_pos] == t[t_pos] ) {
        res = mp(f(s_pos + 1,  t_pos + 1), 'S');        // SKIP
        goto exit;
    }

    res =  min(mp(f(s_pos + 1,  t_pos + 1) + 1, 'R'),   // REPLACE
           min(mp(f(s_pos,      t_pos + 1) + 1, 'I'),   // INSERT
               mp(f(s_pos + 1,  t_pos    ) + 1, 'D'))); // DELETE

exit:
    tab[s_pos][t_pos] = res;
    was[s_pos][t_pos] = true;

    return ( res.first );
}

int d = 0;

void doMagic(int s_pos = 0, int t_pos = 0) {
    if ( s.length() == s_pos ) {
        for (int i = t_pos, p = 0; i < t.length(); i++, p++)
            cout << "INSERT " << s_pos+d+p << " " << t[i] << endl;

        goto exit;
    }

    if (         t.length() == t_pos ) {
        for (int i = s_pos; i < s.length(); i++)
            cout << "DELETE " << s_pos+d+1 << endl;

        goto exit;
    }

    if ( s[s_pos] == t[t_pos] ) {
        doMagic( s_pos + 1,  t_pos + 1);
        goto exit;
    }

    switch ( tab[s_pos][t_pos].second ) {
        case 'R':
            cout << "REPLACE " << s_pos+d+1 << " " << t[t_pos] << endl;
            doMagic(s_pos + 1,  t_pos + 1);
            break;

        case 'I':
            cout << "INSERT "  << s_pos+d+1 << " " << t[t_pos] << endl;
            d++;
            doMagic(s_pos,      t_pos + 1);
            break;

        case 'D':
            cout << "DELETE " << s_pos+d+1 << endl;
            d--;
            doMagic(s_pos + 1,  t_pos    );
            break;
    }

exit:;
}

int main() {
#ifndef ONLINE_JUDGE
    freopen("input.txt", "rt", stdin);
#endif

    cin >> s >> t;

    int res = f();

    cout << res << endl;

    doMagic();

exit:
    return ( 0 );
}


// I love natalia

#include <iostream>
#include <cstdio>
#include <string>

using namespace std;

#define mp make_pair
#define pb push_back

string s;
string t;

pair <int, char>  tab[1010][1010];
bool              was[1010][1010];

int f(int s_pos = 0, int t_pos = 0) {
    if (         was[s_pos][t_pos] )
        return ( tab[s_pos][t_pos].first );

    pair <int, char> res;

    if ( s_pos == s.length() &&
         t_pos == t.length() ) {
        res = mp( 0, 0 );
        goto exit;
    }

    if (          s.length() == s_pos ) {
                  f(s_pos,      t_pos + 1);
        res = mp( t.length() -  t_pos, 'I');            // INSERT
        goto exit;
    }

    if (          t.length() == t_pos ) {
                  f(s_pos + 1,  t_pos    );
        res = mp( s.length() -  s_pos, 'D');            // DELETE
        goto exit;
    }

    if (          s[s_pos] == t[t_pos] ) {
        res = mp( f(s_pos + 1,  t_pos + 1), 'S');       // SKIP
        goto exit;
    }

    res =  min(mp(f(s_pos + 1,  t_pos + 1) + 1, 'R'),   // REPLACE
           min(mp(f(s_pos,      t_pos + 1) + 1, 'I'),   // INSERT
               mp(f(s_pos + 1,  t_pos    ) + 1, 'D'))); // DELETE

exit:
    tab[s_pos][t_pos] = res;
    was[s_pos][t_pos] = true;

    return ( res.first );
}

int d = 0;

void doMagic(int s_pos = 0, int t_pos = 0) {
    if ( s_pos == s.length() &&
         t_pos == t.length() ) {

        goto exit;
    }

    if ( s.length() == s_pos ) {
        //for (int i = t_pos, p = 0; i < t.length(); i++, p++)
            cout << "INSERT " << s_pos+d+1 << " " << t[t_pos] << endl;
            d++;
            doMagic(s_pos,      t_pos + 1);

        goto exit;
    }

    if (         t.length() == t_pos ) {
        //for (int i = s_pos; i < s.length(); i++)
            cout << "DELETE " << s_pos+d+1 << endl;
            d--;
            doMagic(s_pos + 1,  t_pos    );

        goto exit;
    }

    if ( s[s_pos] == t[t_pos] ) {
        doMagic( s_pos + 1,  t_pos + 1);
        goto exit;
    }

    switch ( tab[s_pos][t_pos].second ) {
        case 'R':
            cout << "REPLACE " << s_pos+d+1 << " " << t[t_pos] << endl;
            doMagic(s_pos + 1,  t_pos + 1);
            break;

        case 'I':
            cout << "INSERT "  << s_pos+d+1 << " " << t[t_pos] << endl;
            d++;
            doMagic(s_pos,      t_pos + 1);
            break;

        case 'D':
            cout << "DELETE " << s_pos+d+1 << endl;
            d--;
            doMagic(s_pos + 1,  t_pos    );
            break;
    }

exit:;
}

int main() {
#ifndef ONLINE_JUDGE
    freopen("input.txt", "rt", stdin);
#endif

    cin >> s >> t;

    int res = f();

    cout << res << endl;

    doMagic();

exit:
    return ( 0 );
}


// I love natalia

#include <iostream>
#include <cstdio>
#include <string>

using namespace std;

#define mp make_pair
#define pb push_back

string s;
string t;

pair <int, char>  tab[1010][1010];
bool              was[1010][1010];

int f(int s_pos = 0, int t_pos = 0) {
    if (         was[s_pos][t_pos] )
        return ( tab[s_pos][t_pos].first );

    pair <int, char> res;

    if (         s.length() == s_pos ) {
        res = mp(t.length() -  t_pos, 'I');             // INSERT
        goto exit;
    }

    if (         t.length() == t_pos ) {
        res = mp(s.length() -  s_pos, 'D');             // DELETE
        goto exit;
    }

    if (         s[s_pos] == t[t_pos] ) {
        res = mp(f(s_pos + 1,  t_pos + 1), 'S');        // SKIP
        goto exit;
    }

    res =  min(mp(f(s_pos + 1,  t_pos + 1) + 1, 'R'),   // REPLACE
           min(mp(f(s_pos,      t_pos + 1) + 1, 'I'),   // INSERT
               mp(f(s_pos + 1,  t_pos    ) + 1, 'D'))); // DELETE

exit:
    tab[s_pos][t_pos] = res;
    was[s_pos][t_pos] = true;

    return ( res.first );
}

void doMagic(int s_pos = 0, int t_pos = 0) {
    if (         s.length() == s_pos ) {
        for (int i = t_pos; i < t.length(); i++)
            cout << "INSERT " << i+1 << " " << t[i] << endl;

        goto exit;
    }

    if (         t.length() == t_pos ) {
        for (int i = s_pos; i < s.length(); i++)
            cout << "DELETE " << s_pos+1 << endl;

        goto exit;
    }

    if ( s[s_pos] == t[t_pos] ) {
        doMagic( s_pos + 1,  t_pos + 1);
        goto exit;
    }

    switch ( tab[s_pos][t_pos].second ) {
        case 'R':
            cout << "REPLACE " << s_pos+1 << " " << t[t_pos] << endl;
            doMagic(s_pos + 1,  t_pos + 1);
            break;

        case 'I':
            cout << "INSERT "  << s_pos+1 << " " << t[t_pos] << endl;
            doMagic(s_pos,      t_pos + 1);
            break;

        case 'D':
            cout << "DELETE " << s_pos+1 << endl;
            doMagic(s_pos + 1,  t_pos    );
            break;
    }

exit:;
}

int main() {
#ifndef ONLINE_JUDGE
    freopen("input.txt", "rt", stdin);
#endif

    cin >> s >> t;

    int res = f();

    cout << res << endl;

    doMagic();

exit:
    return ( 0 );
}


// I love natalia

#include <iostream>
#include <cstdio>
#include <string>

using namespace std;

#define mp make_pair
#define pb push_back

string s;
string t;

pair <int, char>  tab[1010][1010];
bool              was[1010][1010];

int f(int s_pos = 0, int t_pos = 0) {
    if (         was[s_pos][t_pos] )
        return ( tab[s_pos][t_pos].first );

    pair <int, char> res;

    if (          s.length() == s_pos &&
                  t.length() == t_pos )
        goto exit;

    if (          s.length() == s_pos ) {
        res =  mp(f(s_pos,      t_pos + 1) + 1, 'I');   // INSERT
        goto exit;
    }

    if (          t.length() == t_pos ) {
        res =  mp(f(s_pos + 1,  t_pos    ) + 1, 'D');   // DELETE
        goto exit;
    }

    if (          s[s_pos] == t[t_pos] ) {
        res =  mp(f(s_pos + 1,  t_pos + 1),     'S');   // SKIP
        goto exit;
    }

    res =  min(mp(f(s_pos + 1,  t_pos + 1) + 1, 'R'),   // REPLACE
           min(mp(f(s_pos,      t_pos + 1) + 1, 'I'),   // INSERT
               mp(f(s_pos + 1,  t_pos    ) + 1, 'D'))); // DELETE

exit:
    tab[s_pos][t_pos] = res;
    was[s_pos][t_pos] = true;

    return ( res.first );
}

int d = 0;

void doMagic(int s_pos = 0, int t_pos = 0) {
    if (          s.length() == s_pos &&
                  t.length() == t_pos )
        goto exit;

    if (          s.length() == s_pos ) {
        cout << "INSERT "  << ( s_pos + (d++) + 1 ) << " " << t[t_pos] << endl;
        doMagic(    s_pos,      t_pos + 1);
        goto exit;
    }

    if (          t.length() == t_pos ) {
        cout << "DELETE "  << ( s_pos + (d--) + 1 )                    << endl;
        doMagic(    s_pos + 1,  t_pos    );
        goto exit;
    }

    if (          s[s_pos] == t[t_pos] ) {
        doMagic(    s_pos + 1,  t_pos + 1);
        goto exit;
    }

    switch ( tab[s_pos][t_pos].second ) {
    case 'R':
        cout << "REPLACE " << ( s_pos +  d    + 1 ) << " " << t[t_pos] << endl;
        doMagic(    s_pos + 1,  t_pos + 1);
        break;

    case 'I':
        cout << "INSERT "  << ( s_pos + (d++) + 1 ) << " " << t[t_pos] << endl;
        doMagic(    s_pos,      t_pos + 1);
        break;

    case 'D':
        cout << "DELETE "  << ( s_pos + (d--) + 1 )                    << endl;
        doMagic(    s_pos + 1,  t_pos    );
        break;
    }

exit:
    ;
}

int main() {
#ifndef ONLINE_JUDGE
    freopen("input.txt", "rt", stdin);
#endif

    cin >> s >> t;

    int res = f();

    cout << res << endl;

    doMagic();

exit:
    return ( 0 );
}


// I love natalia

#include <iostream>
#include <cstdio>
#include <string>

using namespace std;

#define mp make_pair
#define pb push_back

string s;
string t;

pair <int, char>  tab[1010][1010];
bool              was[1010][1010];

int f(int s_pos = 0, int t_pos = 0) {
    if (         was[s_pos][t_pos] )
        return ( tab[s_pos][t_pos].first );

    pair <int, char> res;

    if (         s.length() == s_pos ) {
        res = mp(t.length() -  t_pos, 'I');             // INSERT
        goto exit;
    }

    if (         t.length() == t_pos ) {
        res = mp(s.length() -  s_pos, 'D');             // DELETE
        goto exit;
    }

    if (         s[s_pos] == t[t_pos] ) {
        res = mp(f(s_pos + 1,  t_pos + 1), 'S');        // SKIP
        goto exit;
    }

    res =  min(mp(f(s_pos + 1,  t_pos + 1) + 1, 'R'),   // REPLACE
           min(mp(f(s_pos,      t_pos + 1) + 1, 'I'),   // INSERT
               mp(f(s_pos + 1,  t_pos    ) + 1, 'D'))); // DELETE

exit:
    tab[s_pos][t_pos] = res;
    was[s_pos][t_pos] = true;

    return ( res.first );
}

int d = 0;

void doMagic(int s_pos = 0, int t_pos = 0) {
    if ( s.length() == s_pos ) {
        for (int i = t_pos, p = 0; i < t.length(); i++, p++)
            cout << "INSERT " << s_pos+d+p+1 << " " << t[i] << endl;

        goto exit;
    }

    if (         t.length() == t_pos ) {
        for (int i = s_pos; i < s.length(); i++)
            cout << "DELETE " << s_pos+d+1 << endl;

        goto exit;
    }

    if ( s[s_pos] == t[t_pos] ) {
        doMagic( s_pos + 1,  t_pos + 1);
        goto exit;
    }

    switch ( tab[s_pos][t_pos].second ) {
        case 'R':
            cout << "REPLACE " << s_pos+d+1 << " " << t[t_pos] << endl;
            doMagic(s_pos + 1,  t_pos + 1);
            break;

        case 'I':
            cout << "INSERT "  << s_pos+d+1 << " " << t[t_pos] << endl;
            d++;
            doMagic(s_pos,      t_pos + 1);
            break;

        case 'D':
            cout << "DELETE " << s_pos+d+1 << endl;
            d--;
            doMagic(s_pos + 1,  t_pos    );
            break;
    }

exit:;
}

int main() {
#ifndef ONLINE_JUDGE
    freopen("input.txt", "rt", stdin);
#endif

    cin >> s >> t;

    int res = f();

    cout << res << endl;

    doMagic();

exit:
    return ( 0 );
}


// I love natalia

#include <iostream>
#include <cstdio>
#include <string>

using namespace std;

#define mp make_pair
#define pb push_back

string s;
string t;

pair <int, char>  tab[1010][1010];
bool              was[1010][1010];

int f(int s_pos = 0, int t_pos = 0) {
    if (         was[s_pos][t_pos] )
        return ( tab[s_pos][t_pos].first );

    pair <int, char> res;

    if (         s.length() == s_pos ) {
        res = mp(t.length() -  t_pos, 'I');             // INSERT
        goto exit;
    }

    if (         t.length() == t_pos ) {
        res = mp(s.length() -  s_pos, 'D');             // DELETE
        goto exit;
    }

    if (         s[s_pos] == t[t_pos] ) {
        res = mp(f(s_pos + 1,  t_pos + 1), 'S');        // SKIP
        goto exit;
    }

    res =  min(mp(f(s_pos + 1,  t_pos + 1) + 1, 'R'),   // REPLACE
           min(mp(f(s_pos,      t_pos + 1) + 1, 'I'),   // INSERT
               mp(f(s_pos + 1,  t_pos    ) + 1, 'D'))); // DELETE

exit:
    tab[s_pos][t_pos] = res;
    was[s_pos][t_pos] = true;

    return ( res.first );
}

int d = 0;

void doMagic(int s_pos = 0, int t_pos = 0) {
    if ( s.length() == s_pos ) {
        for (int i = t_pos; i < t.length(); i++)
            cout << "INSERT " << i+d+1 << " " << t[i] << endl;

        goto exit;
    }

    if (         t.length() == t_pos ) {
        for (int i = s_pos; i < s.length(); i++)
            cout << "DELETE " << s_pos+d+1 << endl;

        goto exit;
    }

    if ( s[s_pos] == t[t_pos] ) {
        doMagic( s_pos + 1,  t_pos + 1);
        goto exit;
    }

    switch ( tab[s_pos][t_pos].second ) {
        case 'R':
            cout << "REPLACE " << s_pos+d+1 << " " << t[t_pos] << endl;
            doMagic(s_pos + 1,  t_pos + 1);
            break;

        case 'I':
            cout << "INSERT "  << s_pos+d+1 << " " << t[t_pos] << endl;
            d++;
            doMagic(s_pos,      t_pos + 1);
            break;

        case 'D':
            cout << "DELETE " << s_pos+d+1 << endl;
            d--;
            doMagic(s_pos + 1,  t_pos    );
            break;
    }

exit:;
}

int main() {
#ifndef ONLINE_JUDGE
    freopen("input.txt", "rt", stdin);
#endif

    cin >> s >> t;

    int res = f();

    cout << res << endl;

    doMagic();

exit:
    return ( 0 );
}


#define _CRT_SECURE_NO_WARNINGS
#include <iostream>
#include <vector>
#include <map>
#include <string>
using namespace std;

void main() {
	long long n;
	cin >> n;
	unsigned long long aMax = 0;
	unsigned long long minDifference = ULLONG_MAX;
	unsigned long long *a = new unsigned long long[n];
	for (long long i = 0; i < n; i++)
		cin >> a[i];

	qsort(a, n, sizeof(unsigned long long), [](const void *a, const void *b) {
		return (int)(*(unsigned long long*)a - *(unsigned long long*)b);
	});
	aMax = a[n - 1];
	unsigned long long diffSum = 0;

	for (long long i = 0; i < n - 1; i++) {
		if (a[i + 1] - a[i] < minDifference && a[i + 1] - a[i] > 0)
		{
			long long diff = a[i + 1] - a[i];
			bool f = true;
			for (long long j = 0; j < n; j++) {
				if (aMax - a[j] > 0 && (aMax - a[j]) % diff != 0)
					f = false;
			}
			if (f)
				minDifference = a[i + 1] - a[i];
		}
		diffSum += aMax - a[i];
	}
	if (minDifference == ULLONG_MAX) {
		minDifference = 1;
	}

	cout << diffSum / minDifference << " " << minDifference << endl;

}


#define _CRT_SECURE_NO_WARNINGS
#include <iostream>
#include <vector>
#include <map>
#include <string>
using namespace std;

void main() {
	long long n;
	cin >> n;
	unsigned long long aMax = 0;
	unsigned long long minDifference = ULLONG_MAX;
	unsigned long long *a = new unsigned long long[n];
	for (long long i = 0; i < n; i++)
		cin >> a[i];

	qsort(a, n, sizeof(unsigned long long), [](const void *a, const void *b) {
		return (int)(*(unsigned long long*)a - *(unsigned long long*)b);
	});
	aMax = a[n - 1];
	unsigned long long diffSum = 0;

	for (long long i = 0; i < n - 1; i++) {
		long long diff = a[i + 1] - a[i];
		if (diff < minDifference && diff > 0)
		{
			bool f = true;
			for (long long j = 0; j < n - 1 && f; j++) {
				if (aMax - a[j] > 0 && (aMax - a[j]) % diff != 0)
					f = false;
			}
			if (f)
				minDifference = diff;
		}
		diffSum += aMax - a[i];
	}
	if (minDifference == ULLONG_MAX) {
		minDifference = 1;
	}

	cout << diffSum / minDifference << " " << minDifference << endl;

}


#define _CRT_SECURE_NO_WARNINGS
#include <iostream>
#include <vector>
#include <map>
#include <string>
using namespace std;

void main() {
	long long n;
	cin >> n;
	unsigned long long aMax = 0;
	unsigned long long minDifference = ULLONG_MAX;
	unsigned long long aMin = ULLONG_MAX;
	unsigned long long *a = new unsigned long long[n];
	for (long long i = 0; i < n; i++)
		cin >> a[i];

	qsort(a, n, sizeof(unsigned long long), [](const void *a, const void *b) {
		return (int)(*(unsigned long long*)a - *(unsigned long long*)b);
	});
	aMax = a[n - 1];
	aMin = a[0];
	unsigned long long diffSum = 0;
	for (long long i = 0; i < n-1; i++) {

		if (a[i + 1] - a[i] < minDifference && a[i+1] - a[i] > 0)
			minDifference = a[i + 1] - a[i];
		diffSum += aMax - a[i];
	}
	cout << diffSum / minDifference << " " << minDifference << endl;

}


#define _CRT_SECURE_NO_WARNINGS
#include <iostream>
#include <vector>
#include <map>
#include <string>
using namespace std;

/*
 long long cabelSumBeforeRouter(long long i, long long k) {
	long long count = i - (1 > i - k ? 1 : i - k);
	return ((1 > i - k ? 1 : i - k) + i-1) * count / 2;
}
 long long cabelSumAfterRouter(long long i, long long n) {
	 long long count = n - i - 1;
	 return (i+ n) * count / 2;
 }
void main() {
	long long k, n;
	cin >> n >> k;
	long long i = 0;
	string s;
	cin >> s;
	long long currentSum = 0;
	long long lastCabelSum = 0;
	long long lastRouterIndex  = -1;
	while (i < n) {
		long long j = i + 1;
		if (s[i] == '0') {
			lastCabelSum += j;
			i++;
		}
		else {
			long long t = cabelSumBeforeRouter(j, k);
				lastCabelSum = 0 >  lastCabelSum - t? 0 : lastCabelSum - t;
				currentSum += j;
				currentSum += lastCabelSum;
				lastCabelSum = 0;
				lastRouterIndex = i;

				i += k+1;

		}
	}
	currentSum += lastCabelSum;
	bool f = true;
	if (lastRouterIndex + k < n - 1 && lastRouterIndex > 0) {
		for (i = n - 1; i > lastRouterIndex && f; i--) {
			if (s[i] == '1') {
				f = false;
				currentSum -= cabelSumAfterRouter(i > lastRouterIndex + k ? i : lastRouterIndex + k, n);
				currentSum += i;
			}
		}
	}
	cout << currentSum << endl;
} */
int NOD(int A, int B)
{
	while (A != 0 && B != 0)
		if (A>B) A %= B; else B %= A;
	return A + B;
}

void main() {
	long long n;
	cin >> n;
	unsigned long long aMax = 0;
	unsigned long long minDifference = ULLONG_MAX;

	unsigned long long *a = new unsigned long long[n];
	for (long long i = 0; i < n; i++) {
		cin >> a[i];
		if (a[i] > aMax) aMax = a[i];
	}
	unsigned long long diffSum = aMax - a[0];
	unsigned long long prev = aMax - a[0];
	for (long long i = 1; i < n; i++) {
		prev = NOD(prev, aMax - a[i]);
		diffSum += aMax - a[i];
	}
	cout << diffSum / prev << " " << prev<<endl;
}


#define _CRT_SECURE_NO_WARNINGS
#include <iostream>
#include <vector>
#include <map>
#include <string>
using namespace std;

void main() {
	long long n;
	cin >> n;
	unsigned long long aMax = 0;
	unsigned long long minDifference = ULLONG_MAX;
	unsigned long long *a = new unsigned long long[n];
	for (long long i = 0; i < n; i++)
		cin >> a[i];

	qsort(a, n, sizeof(unsigned long long), [](const void *a, const void *b) {
		return (int)(*(unsigned long long*)a - *(unsigned long long*)b);
	});
	aMax = a[n - 1];
	unsigned long long diffSum = 0;

	for (long long i = 0; i < n - 1; i++) {
		if (a[i + 1] - a[i] < minDifference && a[i + 1] - a[i] > 0)
		{
			long long diff = a[i + 1] - a[i];
			bool f = true;
			for (long long j = 0; j < n; j++) {
				if (aMax - a[j] > 0 && (aMax - a[j]) % diff != 0)
					f = false;
			}
			if (f)
				minDifference = a[i + 1] - a[i];
		}
		diffSum += aMax - a[i];
	}
	if (minDifference == ULLONG_MAX) {
		aMax++;
		minDifference = 0;
		bool f = false;
		while (!f) {
			minDifference++;
			f = true;
			for (long long j = 0; j < n && f; j++) {
				if ((aMax - a[j]) % minDifference != 0)
					f = false;
			}
		}
	}

	cout << diffSum / minDifference << " " << minDifference << endl;

}


#define _CRT_SECURE_NO_WARNINGS
#include <iostream>
#include <vector>
#include <map>
#include <string>
using namespace std;

void main() {
	long long n;
	cin >> n;
	unsigned long long aMax = 0;
	unsigned long long minDifference = ULLONG_MAX;
	unsigned long long aMin = ULLONG_MAX;
	unsigned long long *a = new unsigned long long[n];
	for (long long i = 0; i < n; i++) {
		cin >> a[i];
		if (a[i] > aMax) {
			aMax = a[i];
		}
		if (a[i] < aMin) {
			aMin = a[i];
		}
	}
	unsigned long long diffSum = 0;
	for (long long i = 0; i < n; i++) {
		if (a[i] - aMin > 0 && a[i] - aMin < minDifference) {
			for (long long j = 0; j < n; j++) {
				if ((aMax - a[i]) % (a[i] - aMin) == 0)
					minDifference = a[i] - aMin;
			}
		}
		diffSum += aMax - a[i];
	}
	cout << diffSum / minDifference << " " << minDifference << endl;

}


#include <iostream>
#include <cmath>
#include <vector>
#include <algorithm>
#include <sstream>
#include <map>
#include <set>
#include <queue>
#include <iomanip>
#include <string>
#include <deque>

//#pragma GCC optimize("O3")

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef  double dbl;
typedef string str;

#define drobucs ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define pb push_back

const int  MOD = 1e9 + 7;
const int MAXN = 4e3;
const int INF = 2e9;
const ll INFL = 2e18;

ll gcd(ll a, ll b) {
	return b ? gcd(b, a % b) : a;
}

int main() {
	drobucs;

	int n;
	cin >> n;

	vector<int> v(n);

	for (auto& t : v) cin >> t;

	int maxe = -INF;

	for (auto t : v) {
		if (maxe < t) maxe = t;
	}
	ll sum = 0;
	ll gcdd = 0;
	for (int i = 0; i < n; ++i) {
		if (v[i] != maxe) {
			sum += maxe - v[i];
			gcdd = gcd(gcdd, maxe - v[i]);
		}
	}
	cout << sum / gcdd << " " <<  gcdd;
	return 0;
}


#include <iostream>

using namespace std;
const int N=200010;

long long a[N];
int n;

long long gcd(int a,int b)
{
	return b==0?a:gcd(b,a%b);
}

int main()
{
	cin>>n;
	for(int i=0;i<n;i++)
	{
		scanf("%d",&a[i]);
	}

	int m=0;
	for(int i=0;i<n;i++)
	{
		if(a[i]>m)
		m=a[i];
	}

	long long b[N];

	int cnt=0;

	long long res=0;
	for(int i=0,j=0;i<n;i++)
	{
		res+=m-a[i];
		if(m-a[i]!=0)
		{
			b[j++]=m-a[i];
		}
		cnt=j;
	}
		long long k=0;
	if(cnt>=2)
	{
		k=gcd(b[0],b[1]);
	}
	else
	{
		k=b[0];
	}
	long long p=res/k;

	cout<<p<<' '<<k;

	return 0;
}


#include <iostream>

using namespace std;
const int N=200010;

long long a[N];
int n;

long long gcd(int a,int b)
{
	return b==0?a:gcd(b,a%b);
}

int main()
{
	cin>>n;
	for(int i=0;i<n;i++)
	{
		scanf("%d",&a[i]);
	}

	int m=0;
	for(int i=0;i<n;i++)
	{
		if(a[i]>m)
		m=a[i];
	}

	long long b[N];

	long long res=0;
	for(int i=0,j=0;i<n;i++)
	{
		res+=m-a[i];
		if(m-a[i]!=0)
		{
			b[j++]=m-a[i];
		}
	}

	long long k=gcd(b[0],b[1]);
	long long p=res/k;

	cout<<p<<' '<<k;

	return 0;
}


#include <iostream>

using namespace std;
const int N=200010;

long long a[N];
int n;

long long gcd(int a,int b)
{
	return b==0?a:gcd(b,a%b);
}

int main()
{
	cin>>n;
	for(int i=0;i<n;i++)
	{
		scanf("%d",&a[i]);
	}

	int m=0;
	for(int i=0;i<n;i++)
	{
		if(a[i]>m)
		m=a[i];
	}

	long long b[N];

	int cnt=0;

	long long res=0;
	for(int i=0,j=0;i<n;i++)
	{
		res+=m-a[i];
		if(m-a[i]!=0)
		{
			b[j++]=m-a[i];
		}
		cnt=j;
	}
	long long k=0;

	k=b[0];
	if(cnt>=2)
	{
		for(int i=1;i<cnt;i++)
		{
			k=gcd(k,b[i]);
		}
	}
	long long p=res/k;

	cout<<p<<' '<<k;

	return 0;
}


#include <iostream>

using namespace std;
const int N=200010;

int a[N];
int n;

int gcd(int a,int b)
{
	return b==0?a:gcd(b,a%b);
}

int main()
{
	cin>>n;
	for(int i=0;i<n;i++)
	{
		scanf("%d",&a[i]);
	}

	int m=0;
	for(int i=0;i<n;i++)
	{
		if(a[i]>m)
		m=a[i];
	}

	int b[N];

	int res=0;
	for(int i=0,j=0;i<n;i++)
	{
		res+=m-a[i];
		if(m-a[i]!=0)
		{
			b[j++]=m-a[i];
		}
	}

	int k=gcd(b[0],b[1]);
	int p=res/k;

	printf("%d %d",p,k);

	return 0;
}


#include<functional>
#include<algorithm>
#include<iostream>
#include<cstring>
#include<string>
#include<cstdio>
#include<vector>
#include<queue>
#include<deque>
#include<stack>
#include<cmath>
#include<map>
#include<set>
#define inf 0x3f3f3f3f
#define MAX 100010
using namespace std;
long long n;
long long a[200010];
long long b[200010];
long long gcd(long long x, long long y)
{
	long long z = y;
	while (x % y != 0)
	{
		z = x % y;
		x = y;
		y = z;
	}
	return z;
}
int main() {
	cin >> n;
	long long max_ = 0;
	for (long long i = 1; i <= n; i++) {
		scanf("%lld", &a[i]);
		if (a[i] > max_) {
			max_ = a[i];
		}
	}
	long long l = 0;
	for (long long i = 1; i <= n; i++) {
		if (a[i] < max_) {
			b[l++] = max_ - a[i];
		}
	}
	long long ans = b[0];
	for (long long i = 1; i < l; i++) {
		ans = gcd(ans, b[i]);
	}
	long long anss = 0;
	for (long long i = 0; i < l; i++) {
		anss += b[i] / ans;
	}
	cout << anss << ' ' << ans << endl;
	return 0;
}


#include <iostream>
#include<algorithm>
#include<string.h>
using namespace std;
typedef long long LL;
int a[200010];
int b[200010];
LL gcd(LL a, LL b){
    if(b == 0) return a;
    else return gcd(b, a%b);
}

int main()
{
    int n;
    cin>>n;
    LL ma=0;
    for(int i=0;i<n;i++)
    {
        cin>>a[i];
        if(a[i]>ma)
            ma=a[i];
    }
    LL cnt=a[0];
    a[0]=ma-a[0];
    LL gc=a[0];
    for(int i=1;i<n;i++)
    {
        cnt+=a[i];
        a[i]=ma-a[i];
        gc=gcd(a[i],gc);
    }
    cout<<(ma*n-cnt)/gc<<" ";
    cout<<gc<<endl;
}


#include <iostream>
#include <cstdio>
#include <algorithm>
using namespace std;
typedef long long LL;
LL gcd(LL a, LL b)
{
    if(b == 0)
        return a;
    return gcd(b, a%b);
}
LL a[200005];
LL d[200005];
int main()
{
    int n;
    while(~scanf("%d", &n))
    {
        for(int i = 0; i < n; i++)
            scanf("%lld", &a[i]);
        sort(a, a + n);
        int p = 0;
        LL y, x, z;
        for(int i = 1; i < n; i++)
        {
            d[p++] = a[i] - a[i-1];
        }
        z = d[0];
        for(int i = 1; i < p; i++)
            z = gcd(z, d[i]);
        //cout<<z<<endl;
        LL sum = 0;
        for(int i = 0; i < n; i++)
            sum += a[n-1] - a[i];
        y = sum/z;
        printf("%lld %lld\n", y, z);
    }
    return 0;
}


//
//  main.cpp
//  Мечи
//
//  Created by Владислав on 21/09/2019.
//  Copyright © 2019 Владислав. All rights reserved.
//

#include <iostream>
#include <algorithm>
#include <set>
#include <cmath>

using namespace std;

int gcd(int x, int y) {
    while(x != 0 && y != 0) {
        if(x > y) {
            x %= y;
        } else {
            y %= x;
        }
    }
    return(max(x, y));
}

int n, a[200000 + 14];
long long ans;

int main() {
    cin >> n;
    int ma = -1;
    for(int i = 0; i < n; i++) {
        cin >> a[i];
        ma = max(ma, a[i]);
    }
    int g = gcd(a[0], a[1]);
    for(int i = 2; i < n; i++) {
        g = gcd(g, a[i]);
    }
    if(g == 1) {
            int cnt = 0, b = 0;
            int minr = 1e9;
            sort(a, a + n);
            for(int i = 1; i < n; i++) {
                minr = min(minr, a[i] - a[i - 1]);
            }

            for(int i = 0; i < n; i++) {
                cnt += (ma - a[i]) / minr;
            }
            cout << cnt << " " << minr << '\n';
            return 0;
    }
    for(int i = 0; i < n; i++) {
        ans += (ma - a[i]) / g;
    }
    cout << ans << " " << g << '\n';
    return 0;
}


//
//  main.cpp
//  Мечи
//
//  Created by Владислав on 21/09/2019.
//  Copyright © 2019 Владислав. All rights reserved.
//

#include <iostream>
#include <algorithm>
#include <set>
#include <cmath>

using namespace std;

int gcd(int x, int y) {
    while(x != 0 && y != 0) {
        if(x > y) {
            x %= y;
        } else {
            y %= x;
        }
    }
    return(max(x, y));
}
int n, a[200000 + 14], b[200000 + 14];
long long ans;

int main() {
    cin >> n;
    int ma = -1;
    for(int i = 0; i < n; i++) {
        cin >> a[i];
        ma = max(ma, a[i]);
    }
    for(int i = 0; i < n; i++) {
        b[i] = ma - a[i];
    }
    int g = gcd(b[0], b[1]);
    long long sum = 0;
    for(int i = 0; i < n; i++) {
        g = gcd(g, b[i]);
        sum += b[i];
    }
    ans = sum / g;
    cout << ans << " " << g << '\n';
    return 0;
}


//
//  main.cpp
//  Мечи
//
//  Created by Владислав on 21/09/2019.
//  Copyright © 2019 Владислав. All rights reserved.
//

#include <iostream>
#include <algorithm>
#include <set>
#include <cmath>

using namespace std;

int gcd(int x, int y) {
    while(x != 0 && y != 0) {
        if(x > y) {
            x %= y;
        } else {
            y %= x;
        }
    }
    return(max(x, y));
}

int n, a[200000 + 14];
long long ans;

int main() {
    cin >> n;
    int ma = -1;
    for(int i = 0; i < n; i++) {
        cin >> a[i];
        ma = max(ma, a[i]);
    }
    int g = gcd(a[0], a[1]);
    for(int i = 2; i < n; i++) {
        g = gcd(g, a[i]);
    }
    if(g == 1) {
            int cnt = 0, b = 0;
            int minr = 1e9;
            sort(a, a + n);
            for(int i = 1; i < n; i++) {
                if(a[i] - a[i - 1] != 0) {
                    minr = min(minr, a[i] - a[i - 1]);
                }
            }

            for(int i = 0; i < n; i++) {
                cnt += (ma - a[i]) / minr;
            }
            cout << cnt << " " << minr << '\n';
            return 0;
    }
    for(int i = 0; i < n; i++) {
        ans += (ma - a[i]) / g;
    }
    cout << ans << " " << g << '\n';
    return 0;
}


//
//  main.cpp
//  Мечи
//
//  Created by Владислав on 21/09/2019.
//  Copyright © 2019 Владислав. All rights reserved.
//

#include <iostream>
#include <algorithm>
#include <set>
#include <cmath>

using namespace std;

int gcd(int x, int y) {
    while(x != 0 && y != 0) {
        if(x > y) {
            x %= y;
        } else {
            y %= x;
        }
    }
    return(max(x, y));
}
int n, a[200000 + 14], b[200000 + 14];
long long ans;

int main() {
    cin >> n;
    int ma = -1;
    for(int i = 0; i < n; i++) {
        cin >> a[i];
        ma = max(ma, a[i]);
    }
    int g = gcd(a[0], a[1]);
    for(int i = 0; i < n; i++) {
        if(a[i] != ma) {
            b[i] = ma - a[i];
        }
    }
    for(int i = 2; i < n; i++) {
        g = gcd(g, b[i]);
    }
    set<int> s;
    for(int i = 0; i < n; i++) {
        if(a[i] != 0) {
            s.insert(a[i]);
        }
    }
    for(int i = 0; i < n; i++) {
        ans += (ma - a[i]) / g;
    }
    if(g == 1 && s.size() <= 2) {
        cout << g << " " << ans << '\n';
        return 0;
    }
    cout << ans << " " << g << '\n';
    return 0;
}


//
//  main.cpp
//  Мечи
//
//  Created by Владислав on 21/09/2019.
//  Copyright © 2019 Владислав. All rights reserved.
//

#include <iostream>
#include <algorithm>
#include <set>
#include <cmath>

using namespace std;

int gcd(int x, int y) {
    while(x != 0 && y != 0) {
        if(x > y) {
            x %= y;
        } else {
            y %= x;
        }
    }
    return(max(x, y));
}
int n, a[200000 + 14], b[200000 + 14];
long long ans;

int main() {
    cin >> n;
    int ma = -1;
    for(int i = 0; i < n; i++) {
        cin >> a[i];
        ma = max(ma, a[i]);
    }
    int g = gcd(a[0], a[1]);
    if(g == 0) {
        g = 1;
    }
    for(int i = 0; i < n; i++) {
        if(a[i] != ma) {
            b[i] = ma - a[i];
        }
    }
    for(int i = 2; i < n; i++) {
        g = gcd(g, b[i]);
    }
    set<int> s;
    for(int i = 0; i < n; i++) {
        if(a[i] != 0) {
            s.insert(a[i]);
        }
    }
    for(int i = 0; i < n; i++) {
        ans += (ma - a[i]) / g;
    }
    if(g == 1 && s.size() <= 2) {
        cout << g << " " << ans << '\n';
        return 0;
    }
    cout << ans << " " << g << '\n';
    return 0;
}


#include <array>
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <queue>
#include <set>
#include <fstream>
#include <iomanip>
#include <list>
#include <stack>
#include <map>
#include <unordered_map>
#include <string>
#include <unordered_set>
#include <set>
#include <cmath>
#include <queue>
#include<stack>
#include <algorithm>
using namespace std;

#define var auto

#define ll long long
#define endl '\n'

int gcd(int a, int b)
{
	return b == 0 ? a : gcd(b, a%b);
}

int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	vector<int> input;
	int n;
	cin >> n;
	for (int i = 0; i < n; ++i)
	{
		int x;
		cin >> x;
		input.push_back( x);
	}
	sort(input.begin(), input.end());
	vector<int> difs;
	int m=0;
	for (int i = 0; i < n; ++i)
		m = max(m, input[i]);

	ll s = 0;
	for (int i = 0; i < n; ++i)
		s += m - input[i];
	for (int i = 1; i < n; ++i)
	{
		difs.push_back(input[i] - input[i - 1]);
	}
	int g = difs[0];
	for (int i = 1; i < difs.size(); ++i)
	{
		g = gcd(g, difs[i]);
	}
	cout << s / g << " " << g;
}


    #define _CRT_SECURE_NO_WARNINGS
    #define _USE_MATH_DEFINES
    #include <iostream>
    #include <cstdio>
    #include <vector>
    #include <set>
    #include <queue>
    #include <map>
    #include <string>
    #include <cmath>
    #include <functional>
    #include <algorithm>
    #include <utility>
    #include <stack>
    #include <unordered_map>
    #include <unordered_set>
    #include <iterator>
    #include <fstream>
    #include <iomanip>
    #include <time.h>
    #include <complex>

    using namespace std;

    typedef long double C;
    typedef complex<C> P;

    #define X real()
    #define Y imag()
    #define int long long
    #define ui unsigned int
    #define MP make_pair
    #define timer fghge
    #define y1 yjyjyju
    #define all(X) (X).begin(), (X).end()

int gcd(int a, int b){
    if(b == 0)
    return a;
    else
    return gcd(b, a % b);
}
    signed main()
    {
        ios_base::sync_with_stdio(0);
        cin.tie(0), cout.tie(0);

int n; cin>>n;
vector<int> a(n);
for(auto &i : a)
cin>>i;
sort(all(a));
vector<int> delt(n - 1);
for(int i = 0; i < n - 1; i++)
delt[i] = a[n - 1] - a[i];

int _gcd = delt[0];
for(int i = 1; i < n - 1; i++)
_gcd = gcd(_gcd, delt[i]);

int ans = 0;
for(int i = 0; i < n - 1; i++)
ans += delt[i] / _gcd;
cout << ans << " " << _gcd;
    	return 0;
    }


//20.09.2019
#include<iostream>
#include<vector>
#include<cstdlib>
#include<cmath>
#include<string>
#include<stack>
#include <cassert>
#include<algorithm>
#include<set>
#include <queue>
#include<map>
#include<numeric>
using namespace std;

#define forn(i, n) for(int i = 0; i < int(n); i++)
#define forn3(j, i, n) for(int j = int(i); j < int(n); j++)

using ll = long long;
using vl = vector<long long>;
using vll = vector<vector<long long>>;
using vi = vector<int>;
using vii = vector<vector<int>>;
using vpii = vector<pair<int, int>>;
//int arr[2 * 100000 + 5];
//int arr2[1000000000];
//int grid[1001][1001];

bool comp(pair<int,int> a, pair<int, int> b) {
	if (a.second > b.second)
		return true;
	return false;
}

//int line[2][3 * 100000];

/*int main() {
	int x1, x2, x3, x4, x5, x6, y1, y2, y3, y4, y5, y6;
	cin >> x1 >> y1 >> x2 >> y2;
	cin >> x3 >> y3 >> x4 >> y4;
	cin >> x5 >> y5 >> x6 >> y6;

	forn3(i, )
	return 0;
}
*/

//Task D
int main() {
	cin.sync_with_stdio(false);
	cout.sync_with_stdio(false);
	long long t,q, n, k, temp, c, m, x;
	string s;
	cin >> n;
	vl a(n);
	forn(i, n)
		cin >> a[i];
	sort(a.begin(), a.end());
	long long tog = a[a.size() - 1] * n, count=0;
	long long dif = 9 * 1000 * 1000 * 1000 * 1000;
	forn(i, n) {
		count += a[i];
		if (i != n - 1 && a[i + 1] != a[i])
			dif = min(dif, a[i + 1] - a[i]);
	}
	long long y = (tog - count) / dif;
	cout << y <<" "<< dif << endl;

	return 0;
}

//Test
/*

*/

//Answer:


//20.09.2019
#include<iostream>
#include<vector>
#include<cstdlib>
#include<cmath>
#include<string>
#include<stack>
#include <cassert>
#include<algorithm>
#include<set>
#include <queue>
#include<map>
#include<numeric>
using namespace std;

#define forn(i, n) for(int i = 0; i < int(n); i++)
#define forn3(j, i, n) for(int j = int(i); j < int(n); j++)

using ll = long long;
using vl = vector<long long>;
using vll = vector<vector<long long>>;
using vi = vector<int>;
using vii = vector<vector<int>>;
using vpii = vector<pair<int, int>>;
//int arr[2 * 100000 + 5];
//int arr2[1000000000];
//int grid[1001][1001];

bool comp(pair<int,int> a, pair<int, int> b) {
	if (a.second > b.second)
		return true;
	return false;
}

//int line[2][3 * 100000];

int main() {
	cin.sync_with_stdio(false);
	cout.sync_with_stdio(false);
	int t,q, n, k, temp, c, m, x;
	string s;
	cin >> n;
	vi a(n);
	forn(i, n) {
		cin >> a[i];
	}
	sort(a.begin(), a.end());
	long long tog = 1ll * a[a.size() - 1] * n, count=0;
	int dif = 2 * 1000 * 1000 * 1000;
	forn(i, n) {
		count += a[i];
		if(i!=n-1 && a[i + 1] != a[i])
			dif = min(dif, a[i + 1] - a[i]);
	}
	long long y = 1ll * (tog - count) / dif;
	cout << y <<" "<< dif << endl;

	return 0;
}

//Test
/*

*/

//Answer:


//20.09.2019
#include<iostream>
#include<vector>
#include<cstdlib>
#include<cmath>
#include<string>
#include<stack>
#include <cassert>
#include<algorithm>
#include<set>
#include <queue>
#include<map>
#include<numeric>
using namespace std;

#define forn(i, n) for(int i = 0; i < int(n); i++)
#define forn3(j, i, n) for(int j = int(i); j < int(n); j++)

using ll = long long;
using vl = vector<long long>;
using vll = vector<vector<long long>>;
using vi = vector<int>;
using vii = vector<vector<int>>;
using vpii = vector<pair<int, int>>;
//int arr[2 * 100000 + 5];
//int arr2[1000000000];
//int grid[1001][1001];

bool comp(pair<int,int> a, pair<int, int> b) {
	if (a.second > b.second)
		return true;
	return false;
}

//int line[2][3 * 100000];

int main() {
	cin.sync_with_stdio(false);
	cout.sync_with_stdio(false);
	int t,q, n, k, temp, c, m, x;
	string s;
	cin >> n;
	vl a(n);
	forn(i, n) {
		cin >> a[i];
	}
	sort(a.begin(), a.end());
	long long tog = 1ll * a[a.size() - 1] * n, count=0;
	long long dif = 9 * 1000 * 1000 * 1000 * 1000;
	forn(i, n) {
		count += a[i];
		if(i!=n-1 && a[i + 1] != a[i])
			dif = min(dif, a[i + 1] - a[i]);
	}
	long long y = 1ll * (tog - count) / dif;
	cout << y <<" "<< dif << endl;

	return 0;
}

//Test
/*

*/

//Answer:


//21.09.2019
#include<iostream>
#include<vector>
#include<cstdlib>
#include<cmath>
#include<string>
#include<stack>
#include <cassert>
#include<algorithm>
#include<set>
#include <queue>
#include<map>
#include<numeric>
using namespace std;

#define forn(i, n) for(int i = 0; i < int(n); i++)
#define forn3(j, i, n) for(int j = int(i); j < int(n); j++)

using ll = long long;
using vl = vector<long long>;
using vll = vector<vector<long long>>;
using vi = vector<int>;
using vii = vector<vector<int>>;
using vpii = vector<pair<int, int>>;
//int arr[2 * 100000 + 5];
//int arr2[1000000000];
//int grid[1001][1001];

bool comp(pair<int,int> a, pair<int, int> b) {
	if (a.first < b.first)
		return true;
	return false;
}
//Task D

long long nod(long long a, long long b) {
	while(a!=0 && b!=0)
		if (a > b)
			a %= b;
		else
			b %= a;
	return a + b;
}
int main() {
	cin.sync_with_stdio(false);
	cout.sync_with_stdio(false);
	long long t,q, n, k, temp, c, m, x;
	string s;
	cin >> n;
	vl a(n);
	forn(i, n)
		cin >> a[i];
	sort(a.begin(), a.end());
	long long tog = a[n - 1] * n, count=0;
	long long mm = a[n - 1];
	long long dif = 0;
	forn(i, n) {
		count += a[i];
		dif = nod(dif, mm - a[i]);
	}
	long long y = (tog - count) / dif;
	cout << y <<" "<< dif << endl;

	return 0;
}


#include <stdio.h>
#include <vector>
#include <stack>
#include <functional>
#include <numeric>
#include <complex>
#include <queue>
#include <map>
#include <unordered_map>
#include <list>
#include <set>
#include <unordered_set>
#include <assert.h>
#include <cstring>
#include <sstream>
#include <string>
#include <algorithm>
#include <iostream>

#define sz(x) ((int)(x).size())
#define all(x) (x).begin(), (x).end()
#define X first
#define Y second
#define pb(x) push_back(x)
#define FOR(k, n) for (int k = 0; k < n; k++)
#define FORN(k, s, n) for (int k = s; k < n; k++)
#define debug(x) printf("x = %d\n", x);
#define debug2(x, y) printf("x = %d, y = %d\n", x, y);
#define debug3(x, y, z) printf("x = %d, y = %d, z = %d\n", x, y, z);
#define debug4(x, y, z, t) printf("x = %d, y = %d, z = %d, t = %d\n", x, y, z, t);

#pragma warning(disable : 6031)
#pragma warning(disable : 4101)

using namespace std;

typedef long long ll;
typedef pair<int, int> pii;
typedef long double ld;
typedef complex<double> cd;

const int INF = 1e9;
const long long LINF = 1e18;
const double PI = acos(-1);

// Solution

const int MAXN = 200005;

ll n, g, tot, A[MAXN];

ll gcd(ll a, ll b) {
    if (a == 0) {
        return b;
    } else {
        return gcd(b % a, a);
    }
}

int main() {
    scanf("%lld", &n);

    for (int i = 0; i < n; i++) {
        scanf("%lld", &A[i]);
    }

    sort(A, A + n);

    g = tot = A[n - 1] - A[0];

    for (int i = 1; i < n - 1; i++) {
        g = gcd(g, A[n - 1] - A[i]);
        tot += A[n - 1] - A[i];
    }

    printf("%lld %lld\n", tot / g, g);
    return 0;
}


#include<iostream>
#include<algorithm>
#include<queue>
#include<vector>
#include<functional>
#include<string>
#include<utility>
using namespace std;
int euclid(int x, int y) {
	return (y == 0)? x : euclid(y,x%y);
}
int main() {
	ios::sync_with_stdio(false);
	cin.tie(NULL);
	int n;
	cin >> n;
	int arr[200000];
	int MAX = 0;
	for (int i = 0; i < n; i++) {
		cin >> arr[i];
		MAX = max(MAX, arr[i]);
	}
	vector<int>v;
	for (int i = 0; i < n; i++) {
		arr[i]=MAX-arr[i];
		if (arr[i] != 0)
			v.push_back(arr[i]);
	}
	int now = v[0];
	long long sum = v[0];
	for (int i = 1; i < v.size(); i++) {
		now = euclid(now, v[i]);
		sum += v[i];
	}
	cout << sum / now << " " << now;
}


#include <cstdlib>
#include <vector>
#include <set>
#include <string>
#include <cmath>
#include <algorithm>
#include <iostream>

using namespace std;

#define ll long long
#define INF 1e9
#define f1(vec) for (int i = 0; i < (int)vec.size(); i++)
#define watch(x) cout << (#x) << " is " << x << endl

ll gcd(ll a, ll b) {
	return a ? gcd(b % a, a) : b;
}

int main() {
#ifdef _DEBUG
	freopen("input.txt", "r", stdin);
#endif

	int n; cin >> n;
	vector<ll> a(n);
	ll m = 0;
	int mid = 0;
	ll ops = 0;
	ll ans = INF;
	ll dsum = 0;
	ll bestg = 0;
	for (int i = 0; i < n; i++) {
		cin >> a[i];
		if (a[i] > m) {
			m = a[i];
			mid = i;
		}
	}
	if (mid == 0) {
		cout << 0;
		goto finish;
	}
	for (int i = 0; i < n; i++) {
		dsum += (m - a[i]);
	}
	//watch(dsum);
	ans = dsum;
	while (ops < 1e7) {
		ll la = ans;
		ll g = m - a[0];
		if (g == 0) // only once in 1st loop
			g = m - a[1];
		for (int i = 1; i < n; i++, ops++) {
			if (m - a[i] == 0)
				continue;
			g = gcd(g, m - a[i]);
			if (dsum / g > ans)
				break;
		}
		if (dsum / g < ans) {
			ans = dsum / g;
			bestg = g;
		}
		m++;
		dsum += n;
		ops++;
	}
	cout << ans << " " << bestg;
finish:
#ifdef _DEBUG
	//cout << endl << "Program finished..." << endl;
	while (true);
#endif
	return 0;
}


#include <cstdlib>
#include <vector>
#include <set>
#include <string>
#include <cmath>
#include <algorithm>
#include <iostream>

using namespace std;

#define ll long long
#define INF 1e9
#define f1(vec) for (int i = 0; i < (int)vec.size(); i++)
#define watch(x) cout << (#x) << " is " << x << endl

ll gcd(ll a, ll b) {
	return a ? gcd(b % a, a) : b;
}

int main() {
#ifdef _DEBUG
	freopen("input.txt", "r", stdin);
#endif

	int n; cin >> n;
	vector<ll> a(n);
	ll m = 0;
	int mid = 0;
	ll ops = 0;
	ll ans = INF;
	ll dsum = 0;
	ll bestg = 0;
	for (int i = 0; i < n; i++) {
		cin >> a[i];
		if (a[i] > m) {
			m = a[i];
			mid = i;
		}
	}
	int c = 0;
	for (int i = 0; i < n; i++) {
		if (a[i] == a[0])
			c++;
	}
	if (c == n)
		goto finish;
	for (int i = 0; i < n; i++) {
		dsum += (m - a[i]);
	}
	//watch(dsum);
	ans = dsum;
	while (ops + n < 1e6) {
		ll la = ans;
		ll g = m - a[0];
		if (g == 0) // only once in 1st loop
			g = m - a[1];
		for (int i = 1; i < n; i++, ops++) {
			if (m - a[i] == 0)
				continue;
			g = gcd(g, m - a[i]);
			if (dsum / g > ans)
				break;
		}
		if (dsum / g < ans) {
			ans = dsum / g;
			bestg = g;
		}
		m++;
		dsum += n;
		ops++;
	}
	cout << ans << " " << bestg;
finish:
#ifdef _DEBUG
	//cout << endl << "Program finished..." << endl;
	while (true);
#endif
	return 0;
}


#include <cstdlib>
#include <vector>
#include <set>
#include <string>
#include <cmath>
#include <algorithm>
#include <iostream>

using namespace std;

#define ll long long
#define INF 1e9
#define f1(vec) for (int i = 0; i < (int)vec.size(); i++)
#define watch(x) cout << (#x) << " is " << x << endl

ll gcd(ll a, ll b) {
	return a ? gcd(b % a, a) : b;
}

int main() {
#ifdef _DEBUG
	freopen("input.txt", "r", stdin);
#endif

	int n; cin >> n;
	vector<ll> a(n);
	ll m = 0;
	int mid = 0;
	ll ops = 0;
	ll ans = INF;
	ll dsum = 0;
	ll bestg = 0;
	for (int i = 0; i < n; i++) {
		cin >> a[i];
		if (a[i] > m) {
			m = a[i];
			mid = i;
		}
	}
	if (mid == 0) {
		cout << 0;
		goto finish;
	}
	for (int i = 0; i < n; i++) {
		dsum += (m - a[i]);
	}
	//watch(dsum);
	ans = dsum;
	while (ops + n < 1e6) {
		ll la = ans;
		ll g = m - a[0];
		if (g == 0) // only once in 1st loop
			g = m - a[1];
		for (int i = 1; i < n; i++, ops++) {
			if (m - a[i] == 0)
				continue;
			g = gcd(g, m - a[i]);
			if (dsum / g > ans)
				break;
		}
		if (dsum / g < ans) {
			ans = dsum / g;
			bestg = g;
		}
		m++;
		dsum += n;
		ops++;
	}
	cout << ans << " " << bestg;
finish:
#ifdef _DEBUG
	//cout << endl << "Program finished..." << endl;
	while (true);
#endif
	return 0;
}


#include <cstdlib>
#include <vector>
#include <set>
#include <string>
#include <cmath>
#include <algorithm>
#include <iostream>

using namespace std;

#define ll long long
#define INF 1e9
#define f1(vec) for (int i = 0; i < (int)vec.size(); i++)
#define watch(x) cout << (#x) << " is " << x << endl

ll gcd(ll a, ll b) {
	return a ? gcd(b % a, a) : b;
}

int main() {
#ifdef _DEBUG
	freopen("input.txt", "r", stdin);
#endif

	int n; cin >> n;
	vector<ll> a(n);
	ll m = 0;
	int mid = 0;
	ll ops = 0;

	for (int i = 0; i < n; i++) {
		cin >> a[i];
		if (a[i] > m) {
			m = a[i];
			mid = i;
		}
	}
	ll dsum = 0;
	for (int i = 0; i < n; i++) {
		dsum += (m - a[i]);
	}
	ll ans = dsum;
	ll bestg = 1;
	while (ops + n < 1e6) {
		ll g = m - a[0];
		if (g == 0) // only once in 1st loop
			g = m - a[1];
		for (int i = 1; i < n; i++, ops++) {
			if (m - a[i] == 0)
				continue;
			g = gcd(g, m - a[i]);
			if (dsum / g > ans)
				break;
		}
		if (dsum / g < ans) {
			ans = dsum / g;
			bestg = g;
		}
		m++;
		dsum += n;
		ops++;
	}
	cout << ans << " " << bestg;
finish:
#ifdef _DEBUG
	//cout << endl << "Program finished..." << endl;
	while (true);
#endif
	return 0;
}


#include<stdio.h>
#include<vector>

using namespace std;

int m;

int gcd(int a, int b)
{
        int tmp, n;
        if( a < b ) {
                tmp = a;
                a = b;
                b = tmp;
        }

        while(b != 0) {
                n = a % b;
                a = b;
                b = n;
        }
        return a;
}

int main(void)
{
        int N;
        scanf("%d", &N);
        int i;
        vector<int> v;
        for(i = 0 ; i < N ; i++)
        {
                int val;
                scanf("%d", &val);
                v.push_back(val);
                if( m < val ) {
                        m = val;
                }
        }
        vector<int> r;

        int g = 0;

        for(i =0 ; i < N ; i++)
        {
                if (v[i] != m){
                        int val = m - v[i];
                        r.push_back(val);
                        if( g == 0 ) {
                                g = val;
                        } else {
                                g = gcd(g, val);
                        }
                 } else {
                        r.push_back(0);
                 }
        }

        long long answ = 0;
        for(i =0 ; i < N ; i++)
        {
                answ += (long long)(r[i] / g);
        }

        printf("%lld %d\n",answ, g);

        return 0;
}


#include<stdio.h>
#include<vector>

using namespace std;

int m;

int gcd(int a, int b)
{
        int tmp, n;
        if( a < b ) {
                tmp = a;
                a = b;
                b = tmp;
        }

        while(b != 0) {
                n = a % b;
                a = b;
                b = n;
        }
        return a;
}

int main(void)
{
        int N;
        scanf("%d", &N);
        int i;
        vector<int> v;
        for(i = 0 ; i < N ; i++)
        {
                int val;
                scanf("%d", &val);
                v.push_back(val);
                if( m < val ) {
                        m = val;
                }
        }
        vector<int> r;

        int g = 0;

        for(i =0 ; i < N ; i++)
        {
                if (v[i] != m){
                        int val = m - v[i];
                        r.push_back(val);
                        if( g == 0 ) {
                                g = val;
                        } else {
                                g = gcd(g, val);
                        }
                }
        }

        long long answ = 0;
        for(i =0 ; i < N ; i++)
        {
                answ += (long long)(r[i] / g);
        }

        printf("%lld %d\n",answ, g);

        return 0;
}


#include<stdio.h>
#include<vector>

using namespace std;

int m;

int gcd(int a, int b)
{
        int tmp, n;
        if( a < b ) {
                tmp = a;
                a = b;
                b = tmp;
        }

        while(b != 0) {
                n = a % b;
                a = b;
                b = n;
        }
        return a;
}

int main(void)
{
        int N;
        scanf("%d", &N);
        int i;
        vector<int> v;
        for(i = 0 ; i < N ; i++)
        {
                int val;
                scanf("%d", &val);
                v.push_back(val);
                if( m < val ) {
                        m = val;
                }
        }
        vector<int> r;

        int g = m;

        for(i =0 ; i < N ; i++)
        {
                int val = m - v[i];
                r.push_back(val);
                g = gcd(g, val);
        }

        long long answ = 0;
        for(i =0 ; i < N ; i++)
        {
                answ += (long long)(r[i] / g);
        }
        if( N != 2) {
                printf("%lld %d\n",answ, g);
        } else {
                printf("%d %lld\n",g, answ);
        }

        return 0;
}


#include <iostream>
#include <vector>
#include <cmath>
#include <iomanip>
#include <string>
#include <algorithm>
#include <set>
#include <queue>
using namespace std;

long long nod(long long a,long long b) {
	if (!b) return a;
	else return nod(b, a % b);
}
int main()
{
	int n;
	long long y = 0, z;
	cin >> n;
	vector <long long> dat(n);
	for (int i = 0; i < n; i++)
		cin>>dat[i];
	long long maxi = *max_element(dat.begin(), dat.end());
	vector<long long> a;
	for (int i = 0; i < n; i++) {
		long long s = maxi - dat[i];
		if (s) a.push_back(s);
	}
	for (int i = 1; i < a.size(); i++) {
		a[i] = nod(a[i], a[i - 1]);
	}
	z = a[a.size() - 1];

	for (int i = 0; i < n; i++) {
		y += (maxi - dat[i]) / z;
	}
	cout << y << " " << z;
	return 0;
}


#include <iostream>
#include <vector>
#include <string>
#include <queue>
#include <set>
#include <algorithm>
#include <cmath>
#include <iomanip>
#include <cassert>

#define ll long long

using namespace std;

int gcd(ll x, ll y)
{
	return y ? gcd(y, x % y) : x;
}

int main()
{
	int n;
	cin >> n;
	vector<ll> a(n),x(n),rez;
	for (int i = 0; i < a.size(); ++i) {
		cin >> a[i];
	}
	sort(a.begin(), a.end());

	x = a;

	ll count_pers = 0;
	ll max_elem = a[a.size() - 1];
	ll nod;
	for (int i = 0; i < x.size(); ++i) {
		x[i] = max_elem - x[i];
		if (x[i] != 0) rez.push_back(x[i]);
	}

	for (int i = 1; i < rez.size(); ++i) {
		rez[i] = gcd(rez[i], rez[i - 1]);
	}
	nod = rez[rez.size() - 1];
	for (int i = 0; i < n; ++i) {
		count_pers += (max_elem - a[i]) / nod;
	}

	cout << count_pers << ' ' << nod;

	return 0;
}


#include <iostream>
#include <vector>
#include <string>
#include <queue>
#include <set>
#include <algorithm>
#include <cmath>
#include <iomanip>
#include <cassert>

#define ll long long

using namespace std;

int gcd(ll x, ll y)
{
	return y ? gcd(y, x % y) : x;
}

int main()
{
	int n;
	cin >> n;
	vector<ll> a(n);
	for (int i = 0; i < a.size(); ++i) {
		cin >> a[i];
	}
	sort(a.begin(), a.end());

	if (a.size() == 2) {
		cout << 1 << ' ' << a[1] - a[0] << endl;
		return 0;
	}
	int d = 0;
	while (a[d] == 0) {
		++d;
	}
	ll nod = gcd(a[a.size() - 1], a[d]);
	ll count_pers = 0;

	for (int i = 0; i < a.size() - 1; ++i) {
		count_pers += (a[a.size() - 1] - a[i])/nod;
	}

	cout << count_pers << ' ' << nod;

	return 0;
}


#include <iostream>
#include <vector>
#include <string>
#include <queue>
#include <set>
#include <algorithm>
#include <cmath>
#include <iomanip>
#include <cassert>

#define ll long long

using namespace std;

int gcd(ll x, ll y)
{
	return y ? gcd(y, x % y) : x;
}

int main()
{
	int n;
	cin >> n;
	vector<ll> a(n);
	for (int i = 0; i < a.size(); ++i) {
		cin >> a[i];
	}
	sort(a.begin(), a.end());

	if (a.size() == 2) {
		cout << 1 << ' ' << a[1] - a[0] << endl;
		return 0;
	}
	int d = 0;
	while (a[d] == 0) {
		++d;
	}
	ll nod = gcd(a[a.size() - 1], a[d]);
	ll count_swards = 0;
	for (int i = 0; i < a.size() - 1; ++i) {
		count_swards += a[a.size() - 1] - a[i];
	}

	cout << count_swards / nod << ' ' << nod;

	return 0;
}


#include<cstdio>
#include<cmath>
#include<string>
#include<vector>
#include<algorithm>

using namespace std;

bool func(const pair<long long, long long> &a, const pair<long long, long long> &b)
{
	return a.first > b.first;
}

long long gcd(long long a, long long b)
{
	long long temp;

	while (b != 0)
	{
		a %= b;
		temp = a;
		a = b;
		b = temp;
	}

	return a;
}

int main()
{
	int n;
	vector<long long> arr;
	long long x, y = 0, z = 0;
	int i;
	long long input, lmax = 0;
	long long g;

	scanf("%d", &n);

	for (i = 0; i < n; i++)
	{
		scanf("%lld", &input);

		arr.push_back(input);

		if (input > lmax)
		{
			lmax = input;
		}
	}

	if (lmax == 0)
	{
		printf("0 0\n");

		return 0;
	}

	g = lmax - arr[0];

	for (i = 1; i < n; i++)
	{
		g = gcd(g, lmax - arr[i]);
	}

	z = g;

	if (g == 0)
	{
		printf("0 0\n");

		return 0;
	}

	for (i = 0; i < n; i++)
	{
		y += (lmax - arr[i]) / g;
	}

	printf("%lld %lld\n", y, z);

	return 0;
}


#include<iostream>
#include<vector>
#include<algorithm>
using namespace std;

int gcd(int a, int b) {
	while (a != 0 && b != 0) {
		if (a > b) {
			a %= b;
		} else {
			b %= a;
		}
	}
	return max(a, b);
}

int main(){

    int n;
    cin>>n;

    vector<long long int> v(n);

    for(int i=0;i<n;i++)
        cin>>v[i];

    long long int maxi = 0;

    for(int i=0;i<n;i++)
        maxi = max(maxi,v[i]);

    long long int sum = 0;
    long long int a = 0;

    for(int i=0;i<n;i++){

        sum += (maxi - v[i]);
     //   cout<<sum<<"\n";

            a = gcd(a,maxi-v[i]);
      //  cout<<a<<"    11111\n";

    }
    if(sum==0)
        cout<<"0 0\n";
    else
        cout<<sum/a<<" "<<a;

    return 0;
}


#include<iostream>
#include<algorithm>
#include<cmath>
#include<set>

#define ll long long
using namespace std;

int A[1000050];
int B[1000050];

int gcd(int a, int b){
	int r;
	while (b > 0){
		r = a % b;
		a = b;
		b = r;
	}
	return a;
}

int main(){
	int i, n;
	int ans;
	ll sum;
	scanf("%d", &n);
	set<int> s;
	for (i = 1; i <= n; i++)
		scanf("%d", &A[i]);
	sort(A + 1, A + n + 1);
	sum = 0;
	for (i = 1; i <= n; i++)
		sum += abs(A[n] - A[i]);
	for (i = 2; i <= n; i++)
		B[i] = A[i] - A[i - 1];
	ans = B[1];
	for (i = 2; i <= n; i++)
		ans = gcd(ans, B[i]);
	sum /= ans;
	printf("%lld %d\n", sum, ans);
	return 0;
}


#define _CRT_SECURE_NO_WARNINGS
#include <iostream>
#include <cmath>
#include <math.h>
#include <string>
#include <string.h>
#include <algorithm>
#include <vector>
#include <set>
#include <map>
#include <deque>
#include <queue>
#include <stack>

using namespace std;

#define ll long long
#define fr(i, l, r) for(int i = l; i < r; ++i)
#define for_sl(i, l, r) for(auto i = sl.begin(); i != sl.end(); ++i)
#define elif else if
#define mp make_pair
#define pb push_back

vector <ll> vec;
int x[10];
int y[10];
ll mas[200010];
ll use[200010];

ll inf = 1000000007, mx = 0;
ll n, v, f, s, pr, nod;

ll NOD(ll a, ll b) {
	if (a == 0) {
		return b;
	}
	else {
		return NOD(b % a, a);
	}
}

int main() {
	//freopen("input.txt", "r", stdin);
	//freopen("output.txt", "w", stdout);
	scanf("%d", &n);
	fr(i, 0, n) {
		scanf("%lld", &mas[i]);
		if (mx < mas[i])
			mx = mas[i];
	}
	fr(i, 0, n) {
		vec.pb(mx - mas[i]);
	}
	sort(vec.begin(), vec.end());

	nod = vec[0];
	fr(i, 1, n) {
		nod = NOD(min(nod, vec[i]), max(nod, vec[i]));
	}
	v = 0;
	fr(i, 0, n) {
		v += vec[i] / nod;
	}
	printf("%lld %lld", v, nod);
	return 0;
}


#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const int maxn =   2e5 + 10;
map<ll,int>mp;
ll a[maxn],b[maxn];
ll gcd(ll a,ll b){
    return a == 0?b:gcd(b%a,a);
}
int main(){
    std::ios::sync_with_stdio(false);
    int n;
    ll maxx = -1;
    cin>>n;
    for(int i = 0;i < n;i ++){
        cin>>a[i];
        maxx = max(maxx,a[i]);
    }
    int ou = 0;
    for(int i = 0;i < n;i ++){

        ll val = maxx - a[i];
        if(mp[val] == 0 && val != 0){
            mp[val] = 1;
            b[ou++] = val;
        }
    }
    ll po = b[0];
    for(int i = 1;i < ou;i ++){
        po = gcd(po,b[i]);
    }

    ll ans = 0;
    for(int i = 0;i < n;i ++){
        ans += (maxx - a[i]) / po;
    }

    cout<<ans<<" "<<po<<endl;

    return 0;
}


#include<stdio.h>
#include<algorithm>
#include<iostream>
#include<map>
#define LL long long
using namespace std;
const int maxn = 2e5 + 10;
map<LL,int>mp;
LL arr[maxn], b[maxn];

LL gcd(LL a,LL b)
{
    return a == 0?b:gcd(b%a,a);
    /*
   LL c;
   while(a)
   {
   		c = a % b;
   		a = b;
   		b = c;
   }
   return b;
   */
}

int main()
{
    int n;
    LL maxx = -1;
    cin >> n;
    for(int i = 0;i < n;i ++)
	{
        cin>>arr[i];
        maxx = max(maxx, arr[i]);
    }
    int cnt = 0;
    for(int i = 0;i < n;i ++)
	{

        LL val = maxx - arr[i];
        if(mp[val] == 0 && val != 0)
		{
            mp[val] = 1;
            b[cnt++] = val;
        }
    }
    LL temp = b[0];
    for(int i = 1;i < cnt;i ++)
        temp = gcd(temp,b[i]);
    LL ans = 0;
    for(int i = 0;i < n;i ++)
        ans += (maxx - arr[i]) / temp;
    cout<<ans<<" "<<temp<<endl;
    return 0;
}


#include <iostream>
#include <sstream>
#include <cstdio>
#include <vector>
#include <cmath>
#include <queue>
#include <string>
#include <cstring>
#include <cassert>
#include <iomanip>
#include <algorithm>
#include <set>
#include <map>
#include <ctime>
#include <cmath>

#define forn(i, n) for(int i=0;i<n;++i)
#define fore(i, l, r) for(int i = int(l); i <= int(r); ++i)
#define sz(v) int(v.size())
#define all(v) v.begin(), v.end()
#define pb push_back
#define mp make_pair
#define x first
#define y1 ________y1
#define y second
#define ft first
#define sc second
#define pt pair<int, int>

template<typename X> inline X abs(const X& a) { return a < 0? -a: a; }
template<typename X> inline X sqr(const X& a) { return a * a; }

typedef long long li;
typedef long double ld;

using namespace std;

const int INF = 1000 * 1000 * 1000;
const ld EPS = 1e-9;
const ld PI = acos(-1.0);

const int N = 200 * 1000 + 13;

int n;
int a[N];

inline void read() {
	cin >> n;
	for (int i = 0; i < n; i++) {
		cin >> a[i];
	}
}

inline int gcd(int a, int b) {
	while (a != 0 && b != 0) {
		if (a > b) {
			a %= b;
		} else {
			b %= a;
		}
	}
	return max(a, b);
}

inline void solve() {
	int ma = *max_element(a, a + n);
    li sum = 0;
    for (int i = 0; i < n; i++) {
    	sum += a[i];
    }
    int g = ma - a[0];
    for (int i = 1; i < n; i++) {
    	g = gcd(g, ma - a[i]);
    }
    li ans = (ma * 1ll * n - sum) / g;
    cout << ans << ' ' << g << endl;
}

int main () {
#ifdef fcspartakm
    freopen("input.txt", "r", stdin);
    //freopen("output.txt", "w", stdout);
#endif
    srand(time(NULL));
    cerr << setprecision(10) << fixed;

    read();
    solve();

    //cerr << "TIME: " << clock() << endl;
}


#include <iostream>
#include <algorithm>
#include <set>
#include <cmath>
using namespace std;
int a[2000000],mn[2000000],parz[34015],i,n,l,j;
long long y,k=1,ma;
bool v;
int main()
{
	//31623
	cin>>n;
	for(i=1;i<=n;i++)
	{
	cin>>a[i];
	if(a[i]>ma)
		ma=a[i];
	}
	parz[1]=2;
	l++;
	for(i=3;i<100000;i+=2)
	{
		j=1;
		v=true;
		while(j<=l)
			if(i%parz[j++]==0)
			{
				v=false;
				break;
			}
		if(v==true)
			parz[++l]=i;
	}
	for(i=1;i<=n;i++)
		if(a[i]!=ma)
			mn[i]=ma-a[i];
	for(i=1;i<=l;i++)
	{
		v=true;
		j=1;
		while(j<=n)
		{
			if(mn[j]==0)
				j++;
			else
			if(mn[j++]%parz[i]!=0)
				{
					v=false;
					break;
				}
		}
		if(v==true)
		{
			k*=parz[i];
			for(j=1;j<=n;j++)
				if(mn[j]!=0)
					mn[j]/=parz[i];
			i--;
		}
	}
	for(i=1;i<=n;i++)
		if((ma-a[i])%k==0)
			y+=(ma-a[i])/k;
		else
			y+=(ma-a[i]+k-ma-a[i])/k;
	cout<<y<<" "<<k;
	cin>>i;
	return 0;
}
//12 2


#include <iostream>
using namespace std;
int arr[200004], n, i, k, ma;
long long y;
int gcd(int a, int b)
{
	if (a == 0)
		return b;
	return gcd(b % a, a);
}
int findGCD(int arr[], int n)
{
	int result = arr[0];
	for (int i = 1; i < n; i++)
		result = gcd(arr[i], result);

	return result;
}
int main()
{
	cin >> n;
	for (i = 0; i < n; i++)
	{
		cin >> arr[i];
		if (arr[i] > ma)
			ma = arr[i];
	}
	k=findGCD(arr, n);
	for (i = 0; i < n; i++)
		y += (ma - arr[i]) / k;
	cout << y << " " << k;
	cin >> i;
	return 0;
}


#include <iostream>
#include <algorithm>
#include <set>
#include <cmath>
using namespace std;
int a[2000000],mn[2000000],parz[34015],i,n,l,j;
long long y,k=1,ma;
bool v;
int main()
{
	//31623
	cin>>n;
	for(i=1;i<=n;i++)
	{
	cin>>a[i];
	if(a[i]>ma)
		ma=a[i];
	}
	parz[1]=2;
	l++;
	for(i=3;i<31623;i+=2)
	{
		j=1;
		v=true;
		while(j<=l)
			if(i%parz[j++]==0)
			{
				v=false;
				break;
			}
		if(v==true)
			parz[++l]=i;
	}
	for(i=1;i<=n;i++)
		if(a[i]!=ma)
			mn[i]=ma-a[i];
	for(i=1;i<=l;i++)
	{
		v=true;
		j=1;
		while(j<=n)
		{
			if(mn[j]==0)
				j++;
			else
			if(mn[j++]%parz[i]!=0)
				{
					v=false;
					break;
				}
		}
		if(v==true)
		{
			k*=parz[i];
			for(j=1;j<=n;j++)
				if(mn[j]!=0)
					mn[j]/=parz[i];
			i--;
		}
	}
	for(i=1;i<=n;i++)
		if((ma-a[i])%k==0)
			y+=(ma-a[i])/k;
		else
			y+=(ma-a[i]+k-ma-a[i])/k;
	cout<<y<<" "<<k;
	cin>>i;
	return 0;
}
//12 2


#include <iostream>
using namespace std;
int arr[200004], mn[200004], l, n, i, k, ma;
long long y;
int gcd(int a, int b)
{
	if (a == 0)
		return b;
	return gcd(b % a, a);
}
int findGCD(int arr[], int n)
{
	int result = arr[0];
	for (int i = 1; i < n; i++)
		result = gcd(arr[i], result);

	return result;
}
int main()
{
	cin >> n;
	for (i = 0; i < n; i++)
	{
		cin >> arr[i];
		if (arr[i] > ma)
			ma = arr[i];
	}
	for (i = 0; i < n; i++)
	{
		if (arr[i] != ma)
			mn[l++] = ma - arr[i];
	}
	k=findGCD(mn, l);
	for (i = 0; i < l; i++)
		y += mn[i] / k;
	cout << y << " " << k;
	cin >> i;
	return 0;
}


#include<iostream>
#include<algorithm>
#include<string.h>
#include<string>
#include<stdio.h>
using namespace std;
long long n,i,j,h,a[200005],b[200005],ax=0,l,k=0;
int main(){
	cin>>n;
	for(i=0;i<n;i++){
		scanf("%lld",&a[i]);
		ax=max(ax,a[i]);
	}
	j=0;
	for(i=0;i<n;i++){
		if(ax-a[i]!=0){
			b[j]=ax-a[i];
			j++;
		}
	}
	sort(b,b+j);
	l=b[0];
	for(i=1;i<j;i++){
		if(b[i]/l*l!=b[i]){
			l=(b[i]-l)*b[i]/b[i];
		}
	}
	for(i=0;i<j;i++){
		k=k+b[i]/l;
	}

	cout<<k<<" "<<l<<endl;
}


#include<iostream>
#include<algorithm>
#include<string.h>
#include<string>
#include<stdio.h>
using namespace std;
long long n,i,j,h,a[200005];
int gcd(int a, int b)
{
	return b ? gcd(b, a%b) : a;
}

int main(){
	cin>>n;
	for(i=0;i<n;i++){
		scanf("%lld",&a[i]);
	}
	sort(a,a+n);
	long long g=a[n-1]-a[0];
	for(i=1;i<n-1;i++){
		g=gcd(g,a[n-1]-a[i]);
	}
	long long l=0;
	for(i=0;i<n;i++){
		l+=(a[n-1]-a[i])/g;
	}
	cout<<l<<" "<<g;
}


#include<iostream>
#include<algorithm>
#include<string.h>
#include<string>
#include<stdio.h>
using namespace std;
long long n,i,j,h,a[200005];
int gcd(int a, int b)
{
	return b ? gcd(b, a%b) : a;
}

int main(){
	cin>>n;
	for(i=0;i<n;i++){
		scanf("%lld",&a[i]);
	}
	sort(a,a+n);
	long long g=gcd(a[0],a[n-1]-a[0]);
	for(i=1;i<n-1;i++){
		g=gcd(g,a[n-1]-a[i]);
	}
	long long l=0;
	for(i=0;i<n;i++){
		l+=(a[n-1]-a[i])/g;
	}
	cout<<l<<" "<<g;
}


#include <iostream>
#include <vector>
#include <cmath>
#include <algorithm>
using namespace std;

void findFactors(int, vector<int>&);
int main() {
    int n;
    cin >> n;
    vector<int> a;
    for(int i=0; i<n; i++){
        int temp;
        cin >> temp;
        a.emplace_back(temp);
    }
    sort(a.begin(), a.end());

    int max_ = a[n-1];
    int min_diff = INT_MAX;
    for(int i=(int)a.size()-1; i>0; i--){
        if(a[i] != a[i-1])
            min_diff = min(min_diff, a[i] - a[i-1]);
    }
    //cout << "mind: " << min_diff << endl;
    vector<int> factors;
    findFactors(min_diff, factors);

    vector<int> a_diff;
    for(int i=0; i<n-1; i++){
        a_diff.emplace_back(max_ - a[i]);
    }
    long long int y = 0, z = 0;
    for(int i = (int)factors.size()-1;i>=0; i--){
        y = 0;
        z = factors[i];
        bool find_min = true;
        for(int j:a_diff){
            if(j%factors[i] != 0){
                find_min = false;
                y = 0;
                break;
            }
            else{
                y += j/factors[i];
            }
        }
        if(find_min) break;
        else continue;
    }

    cout << y << " " << z << endl;

    return 0;
}

void findFactors(int min_diff, vector<int>& factors){
    int upper_bound = sqrt(min_diff);
    for(int i=upper_bound; i>=1; i--){
        if(min_diff%i == 0){
            factors.insert(factors.begin(), i);
            factors.emplace_back(min_diff/i);
        }
    }
    return;
}


#include <iostream>
#include <vector>
#include <cmath>
#include <algorithm>
using namespace std;

void findFactors(int, vector<int>&);
int main() {
    int n;
    cin >> n;
    vector<int> a;
    for(int i=0; i<n; i++){
        int temp;
        cin >> temp;
        a.emplace_back(temp);
    }
    sort(a.begin(), a.end());

    int max_ = a[n-1];
    int min_diff = INT_MAX;
    for(int i=(int)a.size()-1; i>0; i--){
        if(a[i] != a[i-1])
            min_diff = min(min_diff, a[i] - a[i-1]);
    }
    //cout << "mind: " << min_diff << endl;
    vector<int> factors;
    findFactors(min_diff, factors);

    vector<int> a_diff;
    for(int i=0; i<n-1; i++){
        a_diff.emplace_back(max_ - a[i]);
    }
    long long int y = 0, z = 0;
    for(int i = (int)factors.size()-1;i>=0; i--){
        y = 0;
        z = factors[i];
        bool find_min = true;
        for(int j:a_diff){
            if(j%i != 0){
                find_min = false;
                y = 0;
                break;
            }
            else{
                y += j/factors[i];
            }
        }
        if(find_min) break;
        else continue;
    }

    cout << y << " " << z << endl;

    return 0;
}

void findFactors(int min_diff, vector<int>& factors){
    int upper_bound = sqrt(min_diff);
    for(int i=upper_bound; i>=1; i--){
        if(min_diff%i == 0){
            factors.insert(factors.begin(), i);
            factors.emplace_back(min_diff/i);
        }
    }
    return;
}


#define _CRT_SECURE_NO_WARNINGS

#pragma GCC optimize("Ofast,no-stack-protector")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#pragma GCC optimize("unroll-loops")
#pragma GCC optimize("fast-math")

#include<iostream>
#include<vector>
#include<cmath>
#include<algorithm>
#include<string>
#include<set>
#include<map>
#include<deque>

using namespace std;
typedef long long ll;
const int INF = 1000000000;
int gcd(int a, int b) {
	if (b == 0)return a;
	return gcd(b, a%b);
}
int main() {
	//freopen("input.txt", "r", stdin);
	//freopen("output.txt", "w", stdout);
	int n; cin >> n;
	vector<int>mas(n);
	for (int i = 0; i < n; i++) {
		cin >> mas[i];
	}
	sort(mas.begin(), mas.end());
	int z = 0;
	for (int i = 1; i < n; i++) {
		if (mas[i] == mas[i - 1])continue;
		if (z == 0) {
			z = mas[i] - mas[i-1];
		}
		else {
			z = gcd(z, abs(mas[i] - mas[i-1]));
		}
	}
	ll x = mas[n - 1];
	ll y = 0;
	for (int i = 0; i < n; i++) {
		y += (x - mas[i]) / z;
	}
	cout << y << ' ' << z;
}


#include <iostream>
#include <cstdio>
//stl
#include <algorithm>
#include <vector>
#include <queue>
#include <stack>
#include <deque>
#include <set>
#include <map>
#include <string>
#include <cmath>
#include <bitset>

#define ll long long
#define ioio ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0)

using namespace std;

ll gcd(ll a, ll b)
{
	while(b){
		a %= b;
		swap(a, b);
	}
	return a;
}

void solve()
{
	int n;
	cin >> n;
	vector<ll>v(n);
	for (auto &i : v)
		cin >> i;
	int m = *max_element(v.begin(), v.end());
	vector<ll>dif(n);
	for (int i = 0; i < n; ++i)
	{
		dif[i] = m - v[i];
	}
	int g;
	for (int i = 0; i < n; ++i)
	{
		if (dif[i]!=0){
			g = dif[i];
			break;
		}
	}
	for (int i = 0; i < n; ++i)
	{
		if (dif[i]!=0)
			g = gcd(g, dif[i]);
	}
	ll ans = 0;
	for (int i = 0; i < n; ++i)
	{
		ans += dif[i]/g;
	}
	cout << ans << ' ' << g;
}

int main()
{
	ioio;
	solve();
}


#include <iostream>
#include <algorithm>
#include <string>
#include <cstring>
#include <cctype>
#include <vector>
#include <queue>
#include <vector>
#include <functional>
#include <set>
#include <cmath>
#include <iomanip>
#include <sstream>
#include <map>

#define forn(i, n) for(int i = 0; i < int(n); i++)
#define int long long
#define all(a) (a).begin(), (a).end()

using namespace std;

const int INF = 1e9 + 7;

vector<bool> isPrime;
vector<int> primes;

struct Node
{
	vector<int> pairs;
};

vector<Node> g;

int GCD(int a, int b)
{
	if (b == 0)
		return a;
	return GCD(b, a % b);
}

signed main()
{
#ifdef ABC
	freopen("input.txt", "r", stdin);
#endif
	int n;
	cin >> n;
	vector<int> a(n);
	for (int i = 0; i < n; i++)
	{
		cin >> a[i];
	}
	int mx = *max_element(a.begin(), a.end());
	int gcd = mx - a[0];
	int sum = mx - a[0];
	for (int i = 1; i < a.size(); i++)
	{
		sum += mx - a[i];
		gcd = GCD(gcd, mx - a[i]);
	}
	cout << sum / gcd << ' ' << gcd << endl;
	return 0;
}


#include <math.h> //vector<vector<int> > a(n, vector<int>(n, 0));
//#include <corecrt_math_defines.h>
#include <cmath>
#include <iomanip>
#include <iostream>
#include <utility>
#include <algorithm>
#include <vector>
#include <stdio.h>
#include <string>
#include <ctime>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <iterator>
#include <cstdlib>
#include <bitset>
//freopen("input.txt", "r", stdin);
//freopen("output.txt", "w", stdout);
#define pause system("pause")
#define ff first
#define ss second
#define white system("color F0")
#define ll long long
using namespace std;
#define INF INT_MAX
int gcd(ll a, ll b) {
	if (b == 0)
		return a;
	else
		return gcd(b, a % b);
}
int lcm(ll a, ll b) {
	return a / gcd(a, b) * b;
}

int main() {
	int n;
	cin >> n;
	vector <ll> a(n);
	ll summ = 0, maxin = 0;
	for(int i = 0; i < n; i++) {
		cin >> a[i];
		maxin = max(maxin, a[i]);
	}
	/*int pred = a[0];
	for (int i = 1; i < n; i++) {
		pred = lcm(pred, a[i]);
	}
	int nod;
	for (int i = 0; i < n - 1; i++) {
		if (i == 0) nod = a[i];
		else nod = gcd(nod, pred - a[i + 1]);
	}
	summ = pred * n-summ;
	cout << pred << " ";
	cout << summ / nod << " " << nod << endl;*/
	for (int i = 0; i < n; i++) {
		summ += maxin - a[i];
	}
	ll nod=0;
	for (int i = 0; i < n; i++) {
		nod = gcd(nod, maxin - a[i]);
	}
	//if (summ%nod==0)
	if (nod == 0) cout << 1 << 1 << endl;
	else cout << summ / nod << " " << nod << endl;
//	pause;
	return 0;
}


#include <math.h> //vector<vector<int> > a(n, vector<int>(n, 0));
//#include <corecrt_math_defines.h>
#include <cmath>
#include <iomanip>
#include <iostream>
#include <utility>
#include <algorithm>
#include <vector>
#include <stdio.h>
#include <string>
#include <ctime>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <iterator>
#include <cstdlib>
#include <bitset>
//freopen("input.txt", "r", stdin);
//freopen("output.txt", "w", stdout);
#define pause system("pause")
#define ff first
#define ss second
#define white system("color F0")
#define ll long long
using namespace std;
#define INF INT_MAX
int gcd(ll a, ll b) {
	if (b == 0)
		return a;
	else
		return gcd(b, a % b);
}
int lcm(ll a, ll b) {
	return a / gcd(a, b) * b;
}

int main() {
	int n;
	cin >> n;
	vector <ll> a(n);
	ll summ = 0, maxin = 0;
	for(int i = 0; i < n; i++) {
		cin >> a[i];
		maxin = max(maxin, a[i]);
	}
	/*int pred = a[0];
	for (int i = 1; i < n; i++) {
		pred = lcm(pred, a[i]);
	}
	int nod;
	for (int i = 0; i < n - 1; i++) {
		if (i == 0) nod = a[i];
		else nod = gcd(nod, pred - a[i + 1]);
	}
	summ = pred * n-summ;
	cout << pred << " ";
	cout << summ / nod << " " << nod << endl;*/
	for (int i = 0; i < n; i++) {
		summ += maxin - a[i];
	}
	ll nod;
	for (int i = 0; i < n - 1; i++) {
		if (i == 0) nod = maxin-a[i];
		else nod = gcd(nod, maxin - a[i + 1]);
	}
	//if (summ%nod==0)
	cout << summ / nod << " " << nod << endl;
//	pause;
	return 0;
}


#include <iostream>
#include <algorithm>
#include <vector>
#include <cmath>
#include <string>
#include <set>

using namespace std;

long long gcd(long long a, long long b) {
	while (a != 0 && b != 0) {
		if (a > b) {
			a %= b;
		}
		else {
			b %= a;
		}
	}
	return max(a, b);
}

int main() {

	long long n, sum = 0;
	cin >> n;
	vector <long long> a(n);

	for (int i = 0; i < n; i++) {
		cin >> a[i];
		sum += a[i];
	}

	long long ma = *max_element(a.begin(), a.end());
	long long g = ma - a[0];

	for (int i = 1; i < n; i++) {
		g = gcd(g, ma - a[i]);
	}

	long long ans = (ma * n - sum) / g;

	cout << ans << " " << g << endl;

}


#include <iostream>
#include <algorithm>
#include <vector>
#include <cmath>
#include <string>
#include <set>

using namespace std;

long long gcd(long long a, long long b) {
	while (a != 0 && b != 0) {
		if (a > b) {
			a %= b;
		}
		else {
			b %= a;
		}
	}
	return max(a, b);
}

int main() {

	long long n, sum = 0;
	cin >> n;
	vector <long long> a(n);

	for (int i = 0; i < n; i++) {
		cin >> a[i];
		sum += a[i];
	}

	long long ma = *max_element(a.begin(), a.end());
	long long g = ma - a[0];

	for (int i = 1; i < n; i++) {
		g = gcd(g, a[i]);
	}

	long long ans = (ma * n - sum) / g;

	cout << ans << " " << g << endl;

}


#include <iostream>
#include <algorithm>
#include <vector>
#include <cmath>
#include <string>
#include <set>

using namespace std;

long long gcd(long long a, long long b) {
	while (a != 0 && b != 0) {
		if (a > b) {
			a %= b;
		}
		else {
			b %= a;
		}
	}
	return max(a, b);
}

int main() {

	long long n, sum = 0;
	cin >> n;
	vector <long long> a(n);

	for (int i = 0; i < n; i++) {
		cin >> a[i];
		sum += a[i];
	}

	if (n == 2) {
		cout << 1 << " " << abs(a[0] - a[1]) << endl;
		return 0;
	}

	long long ma = *max_element(a.begin(), a.end());
	long long g = ma - a[0];

	for (int i = 1; i < n; i++) {
		g = gcd(g, a[i]);
	}

	long long ans = (ma * n - sum) / g;

	cout << ans << " " << g << endl;

}


#include <iostream>

#include <map>
#include <set>
#include <vector>
#include <string>
#include <queue>
using namespace std;
typedef long long ll;
#define vec vector
#define ms multiset
#define pb push_back
#define pll pair<long long, long long>
#define pii pair<int, int>
typedef string str;

template<typename T>
istream& operator >>(istream& in, vec<T>& a) {
	for (int i = 0; i < a.size(); i++) in >> a[i];
	return in;
}

template<typename T>
ostream& operator <<(ostream& out, vec<T>& a) {
	for (int i = 0; i < a.size(); i++) out << a[i];
	return out;
}
template<typename T, typename E>
istream& operator >>(istream& in, pair<T, E>& a) {
	in >> a.first >> a.second;
	return in;
}
int gcd(int a, int b) {
	int c = 1;
	while (b) {
		c = a % b;
		a = b;
		b = c;
	}
	return a;
}

int dx[8] = { -2, -1, 1, 2, 2, 1, -1, -2 };
int dy[8] = { 1, 2, 2, 1, -1, -2, -2, -1 };
int main() {
	cin.tie(0);
	cout.tie(0);
	ios::sync_with_stdio(false);
	int n, mx = 0;
	cin >> n;
	vec<int> a(n);
	long long sum = 0;
	for (int i = 0; i < n; i++)cin >> a[i], sum += a[i], mx = max(a[i], mx);
	int gc = 0;

	for (int i = 0; i < n; i++)
		if (mx - a[i])  gc = mx - a[i];
	for (int i = 0; i < n; i++) {
		if (mx - a[i]) {
			gc = gcd(gc, mx - a[i]);
		}
	}
	long long cnt = 0;
	for (int i = 0; i < n; i++)
		cnt += (mx - a[i]) / gc;
	cout << cnt << " " << gc;
	n = n;

}


#include <iostream>
#include <vector>
#include <algorithm>

using namespace std;

int gcd(int a, int b) {
	while (b) {
		a %= b;
		swap(a, b);
	}
	return a;
}

int main() {
	int n;
	cin >> n;
	vector<int> a(n);
	for (int i = 0; i < n; ++i)
		cin >> a[i];
	int mx = *max_element(a.begin(), a.end()), g = 0;
	for (int i = 0; i < n; ++i)
		g = gcd(g, mx - a[i]);
	long long ans = 0;
	for (int i = 0; i < n; ++i)
		ans += (mx - a[i]) / g;
	cout << ans << " " << g;
	return 0;
}


#include <iostream>
#include <iomanip>
#include <string>
#include <vector>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <algorithm>
#include <math.h>

using namespace std;

long long gcd(long long a, long long b) {
	while (b) {
		a %= b;
		swap(a, b);
	}
	return a;
}

int main() {
	ios::sync_with_stdio(false);
	cin.tie(NULL);
	int n;
	cin >> n;
	vector<int> a(n);
	for (int i = 0; i < n; ++i)
		cin >> a[i];
	int mx = *max_element(a.begin(), a.end());
	long long g = 0;
	for (int i = 0; i < n; ++i)
		g = gcd(g, mx - a[i]);
	long long ans = 0;
	for (int i = 0; i < n; ++i)
		ans += (mx - a[i]) / g;
	cout << ans << " " << g;
	return 0;
}


#include <iostream>
#include <string>
#include <vector>
#include <algorithm>

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

// Function to find gcd of array of
// numbers
int findGCD(std::vector<int>& arr, int n)
{
	int result = arr.at(0);
	for (int i = 1; i < n; i++)
		result = gcd(arr.at(i), result);

	return result;
}

int main()
{
	int n;
	unsigned long long  y = 0;
	unsigned long long z = 0;
	int all_waeopons;
	int max_weapons_num;
	std::vector<int> SwordNumber;
	std::vector<int> Use_vect;
	std::cin >> n;
	for (size_t i = 0; i < n; i++)
	{
		int u;
		std::cin >> u;
		SwordNumber.push_back(u);
	}
	max_weapons_num = *std::max_element(SwordNumber.begin(),SwordNumber.end());
	for (size_t i = 0; i < n; i++)
	{
		if (max_weapons_num != SwordNumber.at(i))
		{
			Use_vect.push_back(SwordNumber.at(i));
		}
	}
	for (size_t i = 0; i < Use_vect.size(); i++)
	{
		Use_vect.at(i) = max_weapons_num - Use_vect.at(i);
	}
	z = findGCD(Use_vect, Use_vect.size());
	for (size_t i = 0; i < Use_vect.size(); i++)
	{
		y += Use_vect.at(i) / z;
	}

	std::cout <<     y <<  z<< std::endl;

	return 0;
}


#include <iostream>
#include <string>
#include <vector>
#include <algorithm>

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

// Function to find gcd of array of
// numbers
int findGCD(std::vector<int>& arr, int n)
{
	int result = arr.at(0);
	for (int i = 1; i < n; i++)
		result = gcd(arr.at(i), result);

	return result;
}

int main()
{
	int n;
	unsigned long long  y = 0;
	unsigned long long z = 0;
	int all_waeopons;
	int max_weapons_num;
	std::vector<int> SwordNumber;
	std::vector<int> Use_vect;
	std::cin >> n;
	for (size_t i = 0; i < n; i++)
	{
		int u;
		std::cin >> u;
		SwordNumber.push_back(u);
	}
	max_weapons_num = *std::max_element(SwordNumber.begin(),SwordNumber.end());
	for (size_t i = 0; i < n; i++)
	{
		if (max_weapons_num != SwordNumber.at(i))
		{
			Use_vect.push_back(SwordNumber.at(i));
		}
	}
	for (size_t i = 0; i < Use_vect.size(); i++)
	{
		Use_vect.at(i) = max_weapons_num - Use_vect.at(i);
	}
	z = findGCD(Use_vect, Use_vect.size());
	for (size_t i = 0; i < Use_vect.size(); i++)
	{
		y += Use_vect.at(i) / z;
	}

	std::cout << std::endl;
	std::cout << std::endl;
	std::cout << std::endl;
	std::cout << max_weapons_num << std::endl;

	std::cout << std::endl;
	std::cout << std::endl;
	std::cout << std::endl;
	std::cout << " y =  " <<  y << "  z  =  "   << z<< std::endl;

	return 0;
}


#include <iostream>
#include <string>
#include <vector>
#include <algorithm>

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

// Function to find gcd of array of
// numbers
int findGCD(std::vector<int>& arr, int n)
{
	int result = arr.at(0);
	for (int i = 1; i < n; i++)
		result = gcd(arr.at(i), result);

	return result;
}

int main()
{
	int n;
	unsigned long long  y = 0;
	unsigned long long z = 0;
	int all_waeopons;
	int max_weapons_num;
	std::vector<int> SwordNumber;
	std::vector<int> Use_vect;
	std::cin >> n;
	for (size_t i = 0; i < n; i++)
	{
		int u;
		std::cin >> u;
		SwordNumber.push_back(u);
	}
	max_weapons_num = *std::max_element(SwordNumber.begin(),SwordNumber.end());
	for (size_t i = 0; i < n; i++)
	{
		if (max_weapons_num != SwordNumber.at(i))
		{
			Use_vect.push_back(SwordNumber.at(i));
		}
	}
	for (size_t i = 0; i < Use_vect.size(); i++)
	{
		Use_vect.at(i) = max_weapons_num - Use_vect.at(i);
	}
	z = findGCD(Use_vect, Use_vect.size());
	for (size_t i = 0; i < Use_vect.size(); i++)
	{
		y += Use_vect.at(i) / z;
	}

	std::cout << " y =  " <<  y << "  z  =  "   << z<< std::endl;

	return 0;
}


#include <iostream>
#include <string>
#include <vector>
#include <algorithm>

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

// Function to find gcd of array of
// numbers
int findGCD(std::vector<int>& arr, int n)
{
	int result = arr.at(0);
	for (int i = 1; i < n; i++)
		result = gcd(arr.at(i), result);

	return result;
}

int main()
{
	int n;
	unsigned long long  y = 0;
	unsigned long long z = 0;
	int all_waeopons;
	int max_weapons_num;
	std::vector<int> SwordNumber;
	std::vector<int> Use_vect;
	std::cin >> n;
	for (size_t i = 0; i < n; i++)
	{
		int u;
		std::cin >> u;
		SwordNumber.push_back(u);
	}
	max_weapons_num = *std::max_element(SwordNumber.begin(),SwordNumber.end());
	for (size_t i = 0; i < n; i++)
	{
		if (max_weapons_num != SwordNumber.at(i))
		{
			Use_vect.push_back(SwordNumber.at(i));
		}
	}
	for (size_t i = 0; i < Use_vect.size(); i++)
	{
		Use_vect.at(i) = max_weapons_num - Use_vect.at(i);
	}
	z = findGCD(Use_vect, Use_vect.size());
	for (size_t i = 0; i < Use_vect.size(); i++)
	{
		y += Use_vect.at(i) / z;
	}

	std::cout << y <<std::endl;
	std::cout << z << std::endl;

	return 0;
}


// Test.cpp : This file contains the 'main' function. Program execution begins and ends there.
//

#include <iostream>
#include <stdio.h>
#include <string.h>
#include <string>
#include <sstream>
#include <algorithm>
#include <map>
#include <cctype>
#include <math.h>
#include <vector>
#include <fstream>;
#define MAXN 100001
#define ll long long
//cin.ignore (std::numeric_limits<std::streamsize>::max(), '\n');
using namespace std;
ll gcd(ll a, ll b)
{
	if (a == 0)
		return b;
	return gcd(b % a, a);
}

// Function to find gcd of array of
// numbers
ll findGCD(ll arr[], ll n)
{
	ll result = arr[0];
	for (int i = 1; i < n; i++)
	{
		result = gcd(arr[i], result);

		if (result == 1)
		{
			return 1;
		}
	}
	return result;
}

int main()
{
	ll n;
	cin >> n;
	ll* arr = new ll[n];
	vector<ll> vec;
	for (int i = 0; i < n; i++)
	{
		ll a;
		cin >> a;
		arr[i] = a;
		vec.push_back(a);
	}
	sort(vec.begin(), vec.end());
	if (n == 2)
	{
		cout << 1 << " " << vec[1] - vec[0];
	}
	else
	{
		ll max = vec[vec.size() - 1];
		ll y = 0;
		ll z = findGCD(arr, n);
		for (int i = 0; i < n; i++)
		{
			if (arr[i] != max)
			{
				y += ((max-arr[i]) / z);

			}
		}
		cout << y << " " << z;
	}

	//2 12 6
	//y = 10, z = 1

	return 0;
}


// Test.cpp : This file contains the 'main' function. Program execution begins and ends there.
//

#include <iostream>
#include <stdio.h>
#include <string.h>
#include <string>
#include <sstream>
#include <algorithm>
#include <map>
#include <cctype>
#include <math.h>
#include <vector>
#include <fstream>;
#define MAXN 100001
#define ll long long
//cin.ignore (std::numeric_limits<std::streamsize>::max(), '\n');
using namespace std;
ll gcd(ll a, ll b)
{
	if (a == 0)
		return b;
	return gcd(b % a, a);
}

// Function to find gcd of array of
// numbers
ll findGCD(ll arr[], ll n)
{
	ll result = arr[0];
	for (int i = 1; i < n; i++)
	{
		result = gcd(arr[i], result);

		if (result == 1)
		{
			return 1;
		}
	}
	return result;
}

int main()
{
	ll n;
	cin >> n;
	ll* arr = new ll[n];
	vector<ll> vec;
	for (int i = 0; i < n; i++)
	{
		ll a;
		cin >> a;
		arr[i] = a;
		vec.push_back(a);
	}
	sort(vec.begin(), vec.end());
	if (n == 2)
	{
		cout << 1 << " " << vec[1] - vec[0];
	}
	else
	{
		ll max = vec[vec.size() - 1];
		ll* rarr = new ll[n];

		for (int i = 0; i < n; i++)
		{
			rarr[i] = max - arr[i];
		}
		ll y = 0;
		ll z = findGCD(rarr, n);
		for (int i = 0; i < n; i++)
		{
			if (arr[i] != max)
			{
				y += ((max-arr[i]) / z);

			}
		}
		cout << y << " " << z;
	}

	//2 12 6
	//y = 10, z = 1

	return 0;
}


#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <stdio.h>

long long int a[200001];

long long int getgcd(long long int a, long long int b)
{
	long long int temp;
	while (b != 0)
	{
		temp = a % b;

		a = b;
		b = temp;
	}
	return a;
}

int main() {
	int n;
	scanf("%d", &n);
	long long int max = 1;
	for (int i = 0; i < n; i++) {
		scanf("%d", &a[i]);
		if (a[i] > max) max = a[i];
	}

	for (int i = 0; i < n; i++) {
		a[i] = max - a[i];
	}

	long long int gcd = -1;

	for (int i = 0; i < n; i++) {
		if (a[i] != 0) {
			if (gcd == -1) {
				gcd = a[i];
			}
			else {
				gcd = getgcd(gcd, a[i]);
			}
		}
	}

	long long int sum = 0;
	for (int i = 0; i < n; i++) {
		sum += a[i] / gcd;
	}

	printf("%lld %lld", sum, gcd);

	return 0;
}

/*
int main() {
	int x1, x2, y1, y2, x3, x4, y3, y4, x5, x6, y5, y6;
	scanf("%d %d %d %d", &x1, &y1, &x2, &y2);
	scanf("%d %d %d %d", &x3, &y3, &x4, &y4);
	scanf("%d %d %d %d", &x5, &y5, &x6, &y6);

	return 0;
}
*/


#include<iostream>
#include<algorithm>
#include<string>
#include<vector>
#include<functional>
#include<queue>
#include<cstring>
#include<set>
#include<map>
#pragma warning(disable:4996)
using namespace std;
typedef int Vtype;
typedef int Ftype;
typedef long long ll;
typedef pair<ll,ll> point;
ll gcd(ll a,ll b){
	if(b == 0) return a;
	return gcd(b,a%b);
}
ll arr[200010];
int main() {
	int n;
	cin>>n;
	ll ma = 0;
	for(int i = 1;i<=n;i++){
		scanf("%lld",&arr[i]);
		ma = max(ma,arr[i]);
	}
	for(int i = 1;i<=n;i++){
		arr[i] = ma-arr[i];
	}
	ll bs = arr[1];
	ll num = 0;
	for(int i = 2;i<=n;i++){
		bs = gcd(max(bs,arr[i]),min(bs,arr[i]));
	}
	for(int i = 1;i<=n;i++){
		num+=arr[i]/bs;
	}
	cout<<num<<" "<<bs;
	return 0;
}


#include <iostream>
#include <algorithm>
using namespace std;
int gcd(int a, int b) {
	while (a != 0 && b != 0) {
		if (a > b) {
			a %= b;
		} else {
			b %= a;
		}
	}
	return max(a, b);
}
int main () {
	int n;
	int a[200000];
	cin >> n;
	for (int i = 0; i < n; i++) {
		cin >> a[i];
	}
    int ma = *max_element(a, a + n);
    long long sum = 0;
    for (int i = 0; i < n; i++) {
    	sum += a[i];
    }
    int g = ma - a[0];
    for (int i = 1; i < n; i++) {
    	g = gcd(g, ma - a[i]);
    }
    long long ans = (ma * 1ll * n - sum) / g;
    cout << ans << ' ' << g;
	return 0;
}