#include <bits/stdc++.h>
using namespace std;
template <class t1, class t2>
using pi = pair<t1, t2>;
template <class t>
using vi = vector<t>;
template <class t>
using vvi = vi<vi<t>>;
template <class t1, class t2>
using um = unordered_map<t1, t2>;
template <class t1, class t2>
using om = map<t1, t2>;
void hinataVSsakura(void);
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  long long t = 1;
  while (t--) hinataVSsakura();
  return 0;
}
struct jutsu {
  long long a, b, c;
};
bool jutsu_compare(jutsu s1, jutsu s2) { return s1.a - s1.b < s2.a - s2.b; }
long long ncr(long long n, long long k) {
  long long res = 1;
  if (k > n - k) k = n - k;
  for (long long i = 0; i < k; ++i) {
    res *= (n - i);
    res /= (i + 1);
  }
  return res;
}
template <typename T>
void printV(vi<T> arr) {
  for (long long i = 0; i < arr.size(); ++i) cout << arr[i] << " ";
  cout << endl;
}
long long max(long long a, long long b) { return (a > b) ? a : b; }
long long min(long long a, long long b) { return (a < b) ? a : b; }
void swap(long long &a, long long &b) {
  a = a ^ b;
  b = a ^ b;
  a = a ^ b;
}
long long index(vector<long long> arr, long long val) {
  auto it = find((arr).begin(), (arr).end(), val);
  if (it != arr.end()) {
    long long ind = it - arr.begin();
    return ind;
  } else
    return -1;
}
long long fact(long long x) {
  if (x == 1 || x == 0) return 1;
  return (x * (fact(x - 1)));
}
bool binarySearch(vector<long long> arr, long long val, long long i,
                  long long j) {
  if (i > j) return 0;
  if (arr[i + ((j - i) / 2)] == val) return 1;
  if (arr[i + ((j - i) / 2)] < val)
    return binarySearch(arr, val, i + ((j - i) / 2) + 1, j);
  return binarySearch(arr, val, i, i + ((j - i) / 2) - 1);
}
void hinataVSsakura(void) {
  long long t = 1;
  while (t--) {
    long long n;
    cin >> n;
    pi<long long, long long> pp[n];
    long long arr1[n], brr[n];
    for (long long i = 0; i < n; ++i) {
      cin >> arr1[i];
      arr1[i]--;
      pp[arr1[i]].first = i;
    }
    for (long long i = 0; i < n; ++i) {
      cin >> brr[i];
      brr[i]--;
      pp[brr[i]].second = i;
    }
    vi<long long> cnt(n, 0);
    for (long long i = 0; i < n; ++i) {
      cnt[(pp[i].first - pp[i].second + n) % n]++;
    }
    long long ans = *max_element((cnt).begin(), (cnt).end());
    cout << ans << endl;
  }
}
