/*Template by hemnath_d(Enlightened by chamow)*/ #include using namespace std; /*--------------------------------------------------------------*/ typedef long long ll; typedef long double ld; typedef vector vec; typedef vector vi; typedef pair pll; typedef pair pii; /*--------------------------------------------------------------*/ #define fastread ios_base::sync_with_stdio(false); cin.tie(NULL); #define pb push_back #define mp make_pair #define fx first #define sx second #define forw(i,a,n) for(i=a;i<=n;i++) #define rev(i,a,n) for(i=a;i>=n;i--) #define For(i,a,n) for(i=a;in;i--) #define inf 100000000000000 #define minf -100000000000000 /*--------------------------------------------------------------*/ //Function to add an edge for graph //Undirected graph void add_edge(vec adj[],ll a,ll b) { adj[a].pb(b); adj[b].pb(a); } /*---------------------------------------------------------------*/ //Comparator class for min-heap using priority_queue //Change the parameters before use class myComparator { public: int operator() (/*Datatype*/int p1,/*Datatype*/int p2) { return p1/*value*/ > p2/*value*/; } }; /*----------------------------------------------------------------*/ //END OF TEMPLATE /*----------------------------------------------------------------*/ int main() { fastread; ll n; cin>>n; ll sum=0; while(n--) { ll val; cin>>val; vec arr,brr; ll t=sqrt(val); ll i,x; forw(i,1,t) { if(val%i==0) { arr.pb(i); x=val/i; brr.pb(x); //cout<=0;i--) { if(last%arr[i]==0) { sum+=arr[i]; last=arr[i]; } } if(val==1) sum--; //cout<<"sum "<