#include <bits/stdc++.h>
using namespace std;
long long int gcd(long long int a, long long int b) {
  if (a > b) {
    a = a + b;
    b = a - b;
    a = a - b;
  }
  if (b % a == 0) return a;
  return gcd(b % a, a);
}
int lcm(int a, int b) { return (a / gcd(a, b)) * b; }
int prime[200000], pcnt;
int defac[200000][2], dcnt;
int era[200000];
int input[200000];
void defac_precompute(int maxnum) {
  int i, j;
  for (i = 2; i <= maxnum; i++) era[i] = i;
  pcnt = 0;
  for (i = 2; i <= maxnum; i++) {
    if (era[i] == 0) continue;
    prime[pcnt++] = i;
    j = i;
    while (j <= maxnum) {
      era[j] = 0;
      j += i;
    }
  }
}
vector<int> pset;
int prdfac(int x) {
  int i, bx = x, p1 = 1, p2 = 1, cnt;
  pset.clear();
  dcnt = 0;
  for (i = 0; i < pcnt; i++) {
    if (bx % prime[i] == 0) {
      defac[dcnt][0] = prime[i];
      defac[dcnt][1] = 0;
      while (bx % prime[i] == 0) {
        bx /= prime[i];
        defac[dcnt][1]++;
      }
      dcnt++;
    }
    if (bx == 1) break;
  }
  if (bx > 1) {
    defac[dcnt][0] = bx;
    defac[dcnt][1] = 1;
    dcnt++;
  }
  cnt = 0;
  for (i = 0; i < dcnt; i++) pset.push_back(defac[i][0]);
  return cnt;
}
tuple<long long int, long long int, long long int> extended_euclidean(
    long long int a, long long int b) {
  if (b == 0) return make_tuple(a, 1, 0);
  int g, x, y;
  tie(g, x, y) = extended_euclidean(b, a % b);
  return make_tuple(g, y, x - (a / b) * y);
}
int fac[200000];
int invfac[200000];
void comb_preprocess(int maxval) {
  invfac[0] = invfac[1] = fac[0] = fac[1] = 1;
  for (int i = 2; i <= maxval; i++)
    fac[i] = (long long int)fac[i - 1] * i % 998244353;
  for (int i = 2; i <= maxval; i++)
    invfac[i] = (long long int)(998244353 - (998244353 / i)) *
                invfac[998244353 % i] % 998244353;
  for (int i = 2; i <= maxval; i++)
    invfac[i] = (long long int)invfac[i - 1] *
                ((invfac[i] + 998244353) % 998244353) % 998244353;
}
int Comb(int n, int r) {
  return (long long int)fac[n] * invfac[r] % 998244353 * invfac[n - r] %
         998244353;
}
vector<int> getPi(string p) {
  int m = (int)p.size(), j = 0;
  vector<int> pi(m, 0);
  for (int i = 1; i < m; i++) {
    while (j > 0 && p[i] != p[j]) j = pi[j - 1];
    if (p[i] == p[j]) pi[i] = ++j;
  }
  return pi;
}
string common(const string& word, const string& rev) {
  vector<int> pi = getPi(rev);
  int m = word.size();
  int begin = 0, matched = 0;
  while (begin + matched < m) {
    if (word[begin + matched] == rev[matched]) {
      matched++;
      if (begin + matched == m) {
        break;
      }
    } else {
      if (matched == 0) {
        begin++;
      } else {
        begin += matched - pi[matched - 1];
        matched = pi[matched - 1];
      }
    }
  }
  return word.substr(begin, m - begin);
}
int a[200200], b[200200], rem[200200];
void solve(int tc) {
  int c, d, x, cnt, mn, mx, tmn, tmx, n;
  cin >> n;
  for (long long int i = 0; i < (n); i++) {
    cin >> x;
    a[x] = i;
  }
  for (long long int i = 0; i < (n); i++) {
    cin >> x;
    b[x] = i;
  }
  for (long long int i = 0; i < (n + 1); i++) rem[i] = 0;
  int i, ans;
  for (i = 1; i <= n; i++) rem[(n + a[i] - b[i]) % n]++;
  ans = 0;
  for (long long int i = 0; i < (n); i++)
    ans = (((ans) > (rem[i])) ? (ans) : (rem[i]));
  cout << ans << endl;
}
int main() {
  int T = 1, tc;
  for (tc = 1; tc <= T; tc++) solve(tc);
}
