#include <bits/stdc++.h>
using namespace std;
const int N = (long long)(2 * 1e5) + 5;
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  map<int, int> mp;
  int n;
  cin >> n;
  vector<int> a(n + 1), b(n + 1), p(n + 1);
  for (int i = 1; i <= n; i++) {
    cin >> a[i];
    p[a[i]] = i;
  }
  for (int i = 1; i <= n; i++) {
    cin >> b[i];
  }
  for (int i = 1; i <= n; i++) {
    int x = p[b[i]] - i;
    if (x < 0) {
      x += n;
    }
    mp[x]++;
  }
  int mx = 0;
  for (auto i : mp) {
    mx = max(mx, i.second);
  }
  cout << mx << endl;
}
