#include using namespace std; typedef pair P; typedef long long ll; typedef long double ld; const int inf=1e9+7; const ll longinf=1LL<<60; #define REP(i,m,n) for(int i=(int)(m) ; i < (int) (n) ; ++i ) #define rep(i,n) REP(i,0,n) #define F first #define S second const int mx=200010; const ll mod=1e9+7; ll gcd(ll a, ll b){ return b ? gcd(b,a%b):a; } struct SegmentTree{ private: int n; vector node; public: SegmentTree(int sz,ll init=0){ n=1; while(n0){ k=(k-1)/2; node[k]=max(node[2*k+1],node[2*k+2]); } } //[a,b)でのmaxを返す ll get(int a,int b,int k=0,int l=0,int r=-1){ if(r<0)r=n; if(r<=a||b<=l)return 0; if(a<=l&&r<=b)return node[k]; ll xl=get(a,b,2*k+1,l,(l+r)/2); ll xr=get(a,b,2*k+2,(l+r)/2,r); return gcd(xl,xr); } }; int main(){ int n; cin >> n; SegmentTree sg(n+1); rep(i,n){ ll a; cin >> a; sg.update(i,a); } ll ans = 0; for(int i=0,r=1; i