#include <bits/stdc++.h>
using namespace std;
bool sortbysec(const pair<int, int> &a, const pair<int, int> &b) {
  return (a.second < b.second);
}
bool compare(const pair<string, int> &a, const pair<string, int> &b) {
  return a.second < b.second;
}
bool compare_float(double x, double y) { return fabs(x - y) < DBL_EPSILON; }
double logn(double n, double r) { return (n > r - 1) ? 1 + logn(n / r, r) : 0; }
vector<long long int> pwx(61);
void cal(long long int x) {
  pwx[0] = 1;
  for (long long int i = 1; i < 61; i++) pwx[i] = x * pwx[i - 1];
}
void solve() {
  long long int n, x;
  cin >> n;
  map<long long int, long long int> mp;
  for (long long int i = 0; i < n; i++) {
    cin >> x;
    mp[x] = i;
  }
  for (long long int i = 0; i < n; i++) {
    cin >> x;
    mp[x] = mp[x] - i;
    mp[x] += n;
    mp[x] %= n;
  }
  map<long long int, long long int> cnt;
  for (auto i : mp) {
    cnt[i.second]++;
  }
  long long int ans = 0;
  for (auto i : cnt) {
    ans = max(ans, i.second);
  }
  cout << ans << "\n";
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  int t = 1, k = 1;
  while (t--) {
    solve();
    k++;
  }
}
