#include<iostream>
#include<vector>
#define rep(i,n) for(int i=0;i<(int)(n);i++)
using namespace std;

inline bool isPeriodic(const vector<int> &s, int t){
  int n = s.size();
  for(int i=0;i<t;i++){
    for(int j=i;j+t<n;j+=t){
      if(s[j] != s[j+t])return false;
    }
  }
  return true;
}

int main(){
  int n;
  cin >> n;
  vector<int> s(n);
  rep(i,n)cin >> s[i];

  int ans = 1;
  for(int x=1;x*x<=n;x++){
    if( n%x == 0 ){
      if(isPeriodic(s,x))ans = max(ans, n/x);
      if(isPeriodic(s,n/x))ans = max(ans, x);
    }
  }

  cout << ans << endl;
}