#include <bits/stdc++.h>
using namespace std;
int32_t main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  ;
  long long n;
  cin >> n;
  long long arr[n + 1];
  long long brr[n + 1];
  vector<long long> freq(n + 1, 0);
  vector<long long> freq1(n + 1, 0);
  map<long long, long long> m1, m2;
  for (long long i = 1; i <= n; ++i) {
    cin >> arr[i];
    m1[arr[i]] = i;
  }
  for (long long i = 1; i <= n; ++i) {
    cin >> brr[i];
    m2[brr[i]] = i;
  }
  for (long long i = 1; i <= n; ++i) {
    if (m2[i] > m1[i]) {
      freq[m2[i] - m1[i]]++;
      freq1[n - m2[i] + m1[i]]++;
    } else if (m1[i] > m2[i]) {
      freq1[m1[i] - m2[i]]++;
      freq[m2[i] + n - m1[i]]++;
    } else {
      freq[0]++;
      freq1[0]++;
    }
  }
  long long ans = 0;
  for (long long i = 0; i <= n; ++i) {
    ans = max({ans, freq[i], freq1[i]});
  }
  cout << ans << "\n";
  return 0;
}
