#include <bits/stdc++.h>

using namespace std;

typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef complex<double> P;
typedef pair<int,int> pii;
#define REP(i,n) for(ll i=0;i<n;++i)
#define REPR(i,n) for(ll i=1;i<n;++i)
#define FOR(i,a,b) for(ll i=a;i<b;++i)

#define DEBUG(x) cout<<#x<<": "<<x<<endl
#define DEBUG_VEC(v) cout<<#v<<":";REP(i,v.size())cout<<" "<<v[i];cout<<endl
#define ALL(a) (a).begin(),(a).end()

#define MOD (ll)(1e9+7)
#define ADD(a,b) a=((a)+(b))%MOD
#define FIX(a) ((a)%MOD+MOD)%MOD

int n;
int s[252521];

bool check(int t){
  REP(i,n-t){
    if(s[i]!=s[i+t])return false;
  }
  return true;
}

int main(){
  scanf("%d",&n);
  REP(i,n)scanf("%d",s+i);
  // ?´???°??¨??????
  vi yakusuu;
  for(int i=1;i*i<=n;++i){
    if(n%i!=0)continue;
    yakusuu.push_back(i);
    if(i*i!=n)yakusuu.push_back(n/i);
  }
  sort(ALL(yakusuu));
  REP(i,yakusuu.size()-1){
    int t = yakusuu[i];
    if(check(t)){
      int ans = n/t;
      printf("%d\n",ans);
      return 0;
    }
  }
  puts("1");
  return 0;
}