#include<bits/stdc++.h>
using namespace std;
typedef long long LL;
typedef vector<int> V;
#define F(N,S,E) for(int N=(int)(S);N<=(int)(E);N++)
#define R(N,S,E) for(int N=(int)(S);N>=(int)(E);N--)
#define D(N,E) for(int N=0;N<(int)(E);N++)
LL read(){LL x;scanf("%lld",&x);return x;}

int main(){
	int n=read();
	int mx=-1;
	LL sum=0;
	LL sum2=0;
	F(i,1,n){
		int a=read();
		mx=max(mx,a);
		sum+=a;
		sum2+=sum;
		printf("%lld\n",(LL)mx*i+sum2);
	}
	return 0;
}
#include <iostream>
using namespace std;
typedef long long ll;

int main() {
    int N, A[110];
    cin >> N;
    for (int i = 0; i < N; ++i){
        cin >> A[i];        
    }

    int res = 0;
    int res_index = 2;
    for(int i = 2; i <= 1000; ++i){

        int score = 0; 
        for (int j = 0; j < N; ++j){
            if (A[j] % i == 0) score++;
        }

        if (score >= res){
            res = score;
            res_index = i;
        }
    }

    cout << res_index << endl;
    return 0;
}