#include <bits/stdc++.h>
using namespace std;
template <class T, class U>
inline T swap(T &a, U &b) {
  T tmp = a;
  a = b;
  b = tmp;
}
template <class T>
T gcd(T a, T b) {
  return (b != 0 ? gcd<T>(b, a % b) : a);
}
template <class T>
T lcm(T a, T b) {
  return (a / gcd<T>(a, b) * b);
}
int shiftCnt[200000 + 5];
int position[200000 + 5];
int getShiftCnt(int source, int target, int sz) {
  if (source < target) return target - source;
  return sz - source + target;
}
int main() {
  int n;
  while (scanf("%d", &n) != -1) {
    memset(shiftCnt, 0, sizeof shiftCnt);
    for (int i = 0; i < n; ++i) {
      int a = ({
        int a;
        scanf("%d", &a);
        a;
      });
      position[a] = i;
    }
    for (int i = 0; i < n; ++i) {
      int b = ({
        int a;
        scanf("%d", &a);
        a;
      });
      int target = position[b];
      shiftCnt[getShiftCnt(i, target, n)]++;
    }
    int mx = shiftCnt[n];
    for (int i = 0; i < n; ++i) {
      if (shiftCnt[i] > mx) mx = shiftCnt[i];
    }
    printf("%d\n", mx);
  }
}
