#include <bits/stdc++.h>
const int N = 200100;
int indices[N];
int freq[N * 2];
int main() {
  int n;
  std::cin >> n;
  int x;
  for (int i = 0; i < n; i++) {
    std::cin >> x;
    indices[x] = i;
  }
  for (int i = 0; i < n; i++) {
    std::cin >> x;
    int shift_amount = (i - indices[x] + n) % n;
    freq[shift_amount]++;
  }
  int res = 0;
  for (auto& i : freq) {
    res = std::max(res, i);
  }
  std::cout << res << '\n';
}
