#include <bits/stdc++.h>
using namespace std;
const int MAXN = 1000005;
const int SQRTN = 1003;
const int LOGN = 22;
const double PI = acos(-1);
const int INF = 1e9;
const int MOD = 1000000007;
const int FMOD = 998244353;
const double eps = 1e-9;
template <typename T>
T gcd(T a, T b) {
  return (b ? __gcd(a, b) : a);
}
template <typename T>
T lcm(T a, T b) {
  return (a * (b / gcd(a, b)));
}
template <typename T>
T add(T a, T b, T c = MOD) {
  T res = a + b;
  return (res >= c ? res - c : res);
}
template <typename T>
T mod_neg(T a, T b, T c = MOD) {
  T res;
  if (abs(a - b) < c)
    res = a - b;
  else
    res = (a - b) % c;
  return (res < 0 ? res + c : res);
}
template <typename T>
T mul(T a, T b, T c = MOD) {
  long long int res = (long long int)a * b;
  return (res >= c ? res % c : res);
}
inline long long int mulmod(long long int a, long long int b,
                            long long int m = MOD) {
  long long int q =
      (long long int)(((long double)a * (long double)b) / (long double)m);
  long long int r = a * b - q * m;
  if (r > m) r %= m;
  if (r < 0) r += m;
  return r;
}
template <typename T>
T expo(T e, T n) {
  T x = 1, p = e;
  while (n) {
    if (n & 1) x = x * p;
    p = p * p;
    n >>= 1;
  }
  return x;
}
template <typename T>
T power(T e, T n, T m = MOD) {
  T x = 1, p = e;
  while (n) {
    if (n & 1) x = mul(x, p, m);
    p = mul(p, p, m);
    n >>= 1;
  }
  return x;
}
template <typename T>
T extended_euclid(T a, T b, T &x, T &y) {
  T xx = 0, yy = 1;
  y = 0;
  x = 1;
  while (b) {
    T q = a / b, t = b;
    b = a % b;
    a = t;
    t = xx;
    xx = x - q * xx;
    x = t;
    t = yy;
    yy = y - q * yy;
    y = t;
  }
  return a;
}
template <typename T>
T mod_inverse(T a, T n = MOD) {
  T x, y, z = 0;
  T d = extended_euclid(a, n, x, y);
  return (d > 1 ? -1 : mod_neg(x, z, n));
}
void solve() {
  long long int idx = 0, x = 0, y = 0, m = 0, curr = 0, num = 0, n1 = 0, n2 = 0,
                n3 = 0, n4 = 0, i = 0, j = 0, p = 0;
  long long int root = 0, sum = 0, diff = INF, q = 0, choice = 0, d = 0,
                len = 0, beg = 0, end = 0, pos = 0, cnt = 0;
  long long int lo = 0, hi = 0, mid = 0, ans = 0;
  bool flag = false;
  string s1, s2, s3, str;
  char ch, ch1, ch2, ch3, *ptr;
  double dub = 0;
  long long int n;
  cin >> n;
  long long int array1[n];
  long long int array2[n];
  map<long long int, long long int> mp1;
  map<long long int, long long int> mp2;
  for (i = 0; i < n; i++) {
    cin >> array1[i];
    mp1[array1[i]] = i;
  }
  for (i = 0; i < n; i++) {
    cin >> array2[i];
    mp2[array2[i]] = i;
  }
  set<long long int> popa;
  long long int difference[n];
  for (i = 0; i < n; i++) difference[i] = 0;
  for (i = 1; i <= n; i++) {
    long long int diffo = mp1[i] - mp2[i];
    diffo = (n + diffo) % n;
    difference[diffo]++;
    popa.insert(diffo);
  }
  long long int maxo = 0;
  for (i = 0; i < n; i++) {
    if (difference[i] > maxo) maxo = difference[i];
  }
  cout << maxo << "\n";
}
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  ;
  long long int t;
  solve();
  return 0;
}
