#include <iostream>
#include <vector>
std::vector<std::size_t> pos1[1<<17], pos2[1<<17];
std::size_t votes[1<<17];
int main(){
    std::ios::sync_with_stdio(false);
    std::cin.tie(NULL);
    std::size_t n;
    std::cin>>n;
    for(std::size_t i=0;i<n;i++){
        std::size_t a;
        std::cin>>a;
        pos1[a-1].push_back(i);
    }
    for(std::size_t i=0;i<n;i++){
        std::size_t a;
        std::cin>>a;
        pos2[a].push_back(n-i);
    }
    for(std::size_t i=0;i<n;i++){
        for(std::size_t a=0;a<pos1[i].size();a++){
            for(std::size_t b=0;b<pos2[i].size();b++){
                votes[(pos1[i][a]+pos2[i][b])%n]++;
            }
        }
    }
    std::size_t max=0;
    for(std::size_t i=0;i<n;i++){
        if(votes[i]>max) max=votes[i];
    }
    std::cout<<max<<'\n';
    return 0;
}
