#include <bits/stdc++.h>
using namespace std;
const long double PI = 3.14159265;
void fast() {
  std::ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
}
int main() {
  fast();
  int n;
  cin >> n;
  int a[200005], b[200005];
  map<int, int> mp;
  for (int i = 0; i < n; i++) {
    int x;
    cin >> x;
    a[x] = i;
  }
  for (int i = 0; i < n; i++) {
    int y;
    cin >> y;
    b[y] = i;
  }
  for (int i = 1; i <= n; i++) {
    int sub = a[i] - b[i];
    if (sub < 0) {
      sub += n;
    }
    mp[sub]++;
  }
  int ans = 0;
  for (auto it : mp) {
    ans = max(ans, it.second);
  }
  cout << ans << '\n';
}
