#include <bits/stdc++.h>
using namespace std;
double PI = 3.1415926536;
const int inf = 1e9 + 7;
inline long long gcd(long long a, long long b) { return b ? gcd(b, a % b) : a; }
inline long long lcm(long long a, long long b) { return a / gcd(a, b) * b; }
inline bool ispalindrome(string s) {
  int n = s.length(), i = 0, j = n - 1;
  while (i <= j) {
    if (s[i] != s[j]) return false;
    i++, j--;
  }
  return true;
}
inline bool isprime(long long n) {
  if (n % 2 == 0) return false;
  for (int i = 3; i * i <= n; i += 2)
    if (n % i == 0) return false;
  return true;
}
const int N = 2e5 + 5;
int n;
int a[N], b[N], pos[N];
map<int, int> offset;
void solve() {
  cin >> n;
  for (int i = 1; i <= n; i++) {
    cin >> a[i];
    pos[a[i]] = i;
  }
  for (int i = 1; i <= n; i++) cin >> b[i];
  for (int i = 1; i <= n; i++) {
    int cur = pos[b[i]] - i;
    if (cur < 0) cur += n;
    offset[cur]++;
  }
  int ans = 0;
  for (auto &it : offset) ans = max(ans, it.second);
  cout << ans;
}
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  int t = 1;
  for (int i = 1; i <= t; i++) {
    solve();
    cout << "\n";
  }
  return 0;
}
