#include <iostream>
#include <cstdio>
using namespace std;
int n, a[1<<17], b[1<<17], ans;
int dist[1<<17];
int main(){
    scanf("%d", &n);
    for(int i = 1; i <= n; i++){
        int x;
        scanf("%d", &x);
        a[x] = i;
    }
    for(int i = 1; i <= n; i++){
        int p;
        scanf("%d", b+i);
        p = i - a[b[i]];
        if(p < 0) p += n;
        p%= n;
        dist[p]++;
        ans = max(dist[p], ans);
    }
    printf("%d\n", ans);
    return 0;
}
//I'm soooo sleepy I can't even read 2 of the tasks properly; acquiesce
