#include <bits/stdc++.h>
using namespace std;
void test(long long testa) {
  long long i, t, k, j, m, x, c, d, l, mina, maxa, h, w, y, p, sb, q, idx, val,
      cur, r, s, b, u, n, ans = 0;
  {
    cin >> n;
    vector<int> a(n), b(n);
    map<long long, long long> mapa;
    for (i = 0; i < n; i++) {
      cin >> a[i];
      mapa[a[i]] = i + 1;
    }
    for (i = 0; i < n; i++) cin >> b[i];
    map<long long, long long> anm;
    ans = 0;
    for (i = 0; i < n; i++) {
      p = mapa[b[i]];
      if (p == 0) continue;
      if (p - i > 0)
        anm[p - i]++;
      else
        anm[n + p - i]++;
    }
    for (auto x : anm) {
      ans = max(x.second, ans);
    }
    cout << ans << endl;
  }
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie();
  long long i, t, k, j, m, x, c, d, l, mina, maxa, h, w, y, p, sb,
      ans = 0, q, idx, val, cur, r, s, a, b, u, n;
  t = 1;
  for (i = 1; i <= t; i++) {
    test(i);
  }
}
