#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  long long int n;
  cin >> n;
  long long int pos[n + 1];
  vector<long long int> a(n + 1);
  vector<long long int> b(n + 1);
  for (long long int i = 1; i <= n; i++) {
    cin >> a[i];
    pos[a[i]] = i;
  }
  for (long long int i = 1; i <= n; i++) cin >> b[i];
  map<long long int, long long int> mp;
  for (long long int i = 1; i <= n; i++) {
    long long int cur = pos[b[i]] - i;
    if (cur < 0) cur += n;
    mp[cur]++;
  }
  long long int mx = INT_MIN;
  for (auto it : mp) {
    mx = max(mx, it.second);
  }
  cout << mx << endl;
}
