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

int N, ans = 1;

int foo(int S[], int k){
  for(int i = 1; i <= k; i++)
    for(int j = i; j <= N; j+=k)
      if(S[i] != S[j]) return 0;
  
  ans = N/k;
  return 1;
}

int main(){
  int S[200100] ,temp;

  cin>>N;

  for(int i = 1; i <= N; i++)cin>>S[i];
  for(int i = 1; i * i <= N; i++){
     if(N%i == 0){if(foo(S, i))break; foo(S, N/i);}
  }
  cout<<ans<<endl;
  
  return 0;
}

