#include <bits/stdc++.h>
using namespace std;
const long long mod = 998244353;
long long gcd(long long a, long long b) { return b ? gcd(b, a % b) : a; }
const int maxn = 2e5 + 10;
int n, a[maxn], b[maxn];
int book[maxn];
int ci[maxn];
int get(int x, int y) {
  if (x < y) {
    return y - x;
  } else if (x == y)
    return 0;
  else {
    return (n - x + y);
  }
}
int main() {
  cin >> n;
  for (int i = 1; i <= n; i++) {
    cin >> a[i];
    book[a[i]] = i;
  }
  int answ = 0;
  for (int i = 1; i <= n; i++) {
    cin >> b[i];
    ci[get(book[b[i]], i)]++;
  }
  for (int i = 0; i <= n; i++) {
    answ = max(answ, ci[i]);
  }
  cout << answ << endl;
  return 0;
}
