#include <bits/stdc++.h>
using namespace std;
const int MAXN = 2e5 + 7;
const int MAXM = 1e9 + 7;
const long long int mod = 1e9 + 7;
const int inf = MAXM;
long long int arr[MAXN];
const int N = 50000;
long long int abso(long long int a, long long int b) {
  if (a > b) {
    return a - b;
  }
  return b - a;
}
void solve() {
  long long int n;
  cin >> n;
  vector<long long int> v1(n);
  vector<long long int> v2(n);
  map<long long int, long long int> mp;
  for (int i = 0; i < n; i++) {
    cin >> v1[i];
    mp[v1[i]] = i;
  }
  map<long long int, long long int> mp2;
  for (int i = 0; i < n; i++) {
    cin >> v2[i];
    if (mp[v2[i]] > i)
      mp2[mp[v2[i]] - i]++;
    else
      mp2[(n + mp[v2[i]] - i) % n]++;
  }
  long long int ans = 0;
  for (auto &it : mp2) {
    ans = max(ans, it.second);
  }
  cout << ans;
}
int main() {
  int t = 1;
  while (t--) {
    solve();
    cout << endl;
  }
}
