#include <bits/stdc++.h>
#include <unordered_map>
using namespace std;
int x[10000];
int main()
{
	int n;
	int cnt=1;
	int i,j;
	int lowest=1000000000;
	scanf("%d",&n);
	for(i=0;i<n;i++)
	{
		scanf("%d",&x[i]);
		lowest=min(x[i],lowest);
	}
	unordered_map<int,int> memo;
	for(i=0;i<n;i++)
	{
		for(j=1;j*j<=x[i]&&j<lowest;j++)
		{
			if(x[i]%j==0)
			{
				memo[j]=__gcd(x[i],memo[j]);
				if(x[i]/j<lowest)
				{
					memo[x[i]/j]=__gcd(memo[x[i]/j],x[i]);
				}
			}
		}
	}
	for(auto tmp:memo)
	{
		if(tmp.first==tmp.second)
		{
			cnt++;
		}
	}
	printf("%d",cnt);
	return 0;
}

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

#define nl "\n"
#define nf endl
#define ll long long
#define pb push_back
#define _ << ' ' <<

#define INF (ll)1e18
#define mod 998244353
#define maxn 400010

ll i, i1, j, k, k1, t, n, m, res, flag[10], a[maxn], b;
priority_queue<ll> pq;

void add(ll x) {
    pq.push(-x); res += x;
}

ll rm() {
    ll x = pq.top(); pq.pop(); res += x; return -x;
}

int main() {
    ios::sync_with_stdio(0);
    cin.tie(0);

    #if !ONLINE_JUDGE && !EVAL
        ifstream cin("input.txt");
        ofstream cout("output.txt");
    #endif

    cin >> n;
    for (i = 1; i <= 2 * n; i++) {
        cin >> a[i];
    }

    for (i = n; i >= 1; i--) {
        add(max(a[i], a[2 * n - i + 1]));
        add(max(rm(), min(a[i], a[2 * n - i + 1])));
        // cout << res << nl;
    }

    cout << res << nl;

    return 0;
}
