#include <bits/stdc++.h>
using namespace std;
int main()
{
    cin.tie(0); ios::sync_with_stdio(false);
    int N; cin >> N; vector<int> s(N);
    for(int i = 0; i < N; i++){cin >> s[i];}
    auto check = [&](const int d){
        for(int i = 0; i < d; i++){
            for(int j = i; j < N; j+= d){if(s[j]!=s[i]){return false;}}
        }  
        return true;
    };
    deque<int> D1,D2;
    for(int d = 1; d*d <= N; d++){
        if(N % d > 0){continue;}
        D1.push_back(d);D2.push_front(N/d);
    }
    for(const int d:D1){if(check(d)){return (cout << N/d << endl),0;}}
    for(const int d:D2){if(check(d)){return (cout << N/d << endl),0;}}
    return 0;
}
