#include <bits/stdc++.h>
using namespace std;
int n, m, cases, t, ans, sz;
string s, s2, s3;
int ar[(int)(1e6 + 10)], ar2[(int)(1e6 + 10)];
int aa[(int)(1e6 + 10)], bb[(int)(1e6 + 10)];
void brainfuck();
void checker() {
  map<int, int> mp;
  map<int, int>::iterator it;
  cin >> n;
  for (int i = 1; i <= n; i++) {
    cin >> ar[i];
    aa[ar[i]] = i;
  }
  for (int i = 1; i <= n; i++) {
    cin >> ar2[i];
    bb[ar2[i]] = i;
  }
  int a;
  for (int i = 1; i <= n; i++) {
    if (bb[i] <= aa[i]) {
      mp[aa[i] - bb[i]]++;
    } else {
      a = aa[i];
      a += n - bb[i];
      mp[a]++;
    }
  }
  ans = 0;
  for (it = mp.begin(); it != mp.end(); it++) {
    ans = max(ans, it->second);
  }
  cout << ans;
}
int main() {
  ios_base::sync_with_stdio(NULL);
  cin.tie(NULL);
  cout.tie(NULL);
  brainfuck();
  return 0;
}
void brainfuck() {
  t = 1;
  while (t--) checker();
}
