#include <bits/stdc++.h>
using namespace std;
void solve() {
  const int N = 1e5 * 2 + 1;
  int m;
  int c[N] = {0};
  int d[N] = {0};
  int r[N] = {0};
  int a;
  cin >> m;
  for (int i = 0; i < m; ++i) {
    cin >> a;
    c[a] = i;
  }
  for (int i = 0; i < m; ++i) {
    cin >> a;
    d[a] = i;
  }
  for (int i = 1; i < m + 1; ++i) {
    int dis = c[i] - d[i];
    if (dis < 0) dis = dis + m;
    r[dis]++;
  }
  int ret = 0;
  for (int i = 0; i < m; ++i) {
    ret = max(ret, r[i]);
  }
  cout << ret << endl;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  ;
  solve();
  return 0;
}
