#include <bits/stdc++.h>
using namespace std;
bool desc(long long int a, long long int b) { return (a > b); }
bool pairone(pair<long long int, long long int> &a,
             pair<long long int, long long int> &b) {
  return (a.first < b.first);
}
void show(vector<int> vec) {
  for (auto x : vec) cout << x << " ";
  cout << endl;
  ;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  ;
  int n;
  cin >> n;
  vector<int> a(n), b(n);
  vector<int> perm_a(n + 1), perm_b(n + 1);
  long long int i;
  for (i = 0; i < n; i++) {
    cin >> a[i];
    perm_a[a[i]] = i;
  }
  for (i = 0; i < n; i++) {
    cin >> b[i];
    perm_b[b[i]] = i;
  }
  map<int, int> shifts2match;
  int j, shift, maxi = 0;
  for (i = 0; i < n; i++) {
    i = perm_b[b[i]];
    j = perm_a[b[i]];
    shift = (j - i >= 0 ? j - i : n + j - i);
    shifts2match[shift]++;
    maxi = max(maxi, shifts2match[shift]);
  }
  cout << maxi;
}
