#include <bits/stdc++.h>
using namespace std;
int ar[200005], br[200005];
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  int n;
  cin >> n;
  for (int i = 1; i <= n; i++) {
    int a;
    cin >> a;
    ar[a] = i;
  }
  for (int i = 1; i <= n; i++) {
    int a;
    cin >> a;
    br[a] = i;
  }
  map<int, int> mp;
  for (int i = 1; i <= n; i++) {
    int val = ar[i] - br[i];
    if (val < 0) val += n;
    mp[val]++;
  }
  int mx = 0;
  for (auto xx : mp) {
    mx = max(mx, xx.second);
  }
  cout << mx << endl;
  return 0;
}
