#include <bits/stdc++.h>
using namespace std;
double exact(long long int a, long long int b) { return (double)a / b; }
long long int gcd(long long int a, long long int b) {
  if (a == 0 || b == 0) {
    return (a + b);
  }
  return gcd(b, a % b);
}
long long int fastExpo(long long int a, long long int n, long long int mod) {
  long long int result = 1;
  while (n > 0) {
    if (n & 1) result = (result * a) % mod;
    a = (a * a) % mod;
    n >>= 1;
  }
  return result;
}
long long int modInverse(long long int n, long long int mod) {
  return fastExpo(n, mod - 2, mod);
}
vector<long long int> factorial(long long int n) {
  std::vector<long long int> fac(n + 2, 0);
  fac[0] = 1;
  for (long long int i = 1; i <= n; i++) fac[i] = (fac[i - 1] * i) % 1000000007;
  return fac;
}
long long int __nCr(long long int n, long long int r,
                    vector<long long int>& Fact, long long int mod) {
  long long int ans = (((Fact[n] * modInverse(Fact[r], mod)) % mod) *
                       modInverse(Fact[n - r], mod)) %
                      mod;
  return ans;
}
vector<long long int> sieve(long long int n) {
  vector<long long int> v(n + 2, 0);
  vector<long long int> primes;
  n++;
  v[0] = 1;
  for (long long int i = 2; i < n; i++) {
    if (!v[i]) {
      primes.push_back(i);
      for (long long int j = 2 * i; j < n; j += i) v[j]++;
    }
  }
  return primes;
}
void solve(long long int T) {
  long long int n;
  cin >> n;
  vector<long long int> arr(n);
  map<long long int, long long int> m1, m2;
  for (long long int i = 0; i < n; i++) {
    cin >> arr[i];
    m1[arr[i]] = i;
  }
  vector<long long int> v(n);
  for (long long int i = 0; i < n; i++) {
    cin >> v[i];
    m2[v[i]] = i;
  }
  long long int ans = 0;
  map<long long int, long long int> m3;
  for (long long int i = 0; i < n; i++) {
    long long int a = m1[arr[i]];
    long long int b = m2[arr[i]];
    long long int d = (a - b + n) % n;
    m3[d]++;
  }
  for (auto each : m3) {
    ans = max(ans, m3[each.first]);
  }
  cout << ans << endl;
}
int32_t main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  long long int T = 1;
  for (long long int t = 1; t <= T; t++) {
    solve(t);
  }
  cerr << "time taken : " << (float)clock() / CLOCKS_PER_SEC << " secs" << endl;
  return 0;
}
