#include <bits/stdc++.h>
using namespace std;
const int inf = 0x3f3f3f3f;
const int N = 2e5 + 10;
const int mod = 998244353;
int a[N], b[N], id[N], dis[N];
int main() {
  int n;
  while (~scanf("%d", &n)) {
    for (int i = 1; i <= n; ++i) {
      scanf("%d", &a[i]);
      id[a[i]] = i;
    }
    for (int i = 1; i <= n; ++i) {
      scanf("%d", &b[i]);
    }
    memset(dis, 0, sizeof(dis));
    for (int i = 1; i <= n; ++i) {
      dis[i] = id[b[i]] - i;
      if (id[b[i]] < i) dis[i] += n;
    }
    map<int, int> mp;
    map<int, int>::iterator it;
    for (int i = 1; i <= n; ++i) {
      mp[dis[i]]++;
    }
    int maxx = 0;
    for (it = mp.begin(); it != mp.end(); ++it) {
      maxx = max(maxx, it->second);
    }
    cout << maxx << '\n';
  }
  return 0;
}
