#include <bits/stdc++.h>
using namespace std;
const double PI = 3.141592653589793238463;
long long int modfun(long long int a, long long int b) {
  long long int result = 1;
  while (b > 0) {
    if (b & 1) {
      a = a % 1000000007;
      result = (result * a) % 1000000007;
      result = result % 1000000007;
    }
    b = b >> 1;
    a = a % 1000000007;
    a = (a % 1000000007 * a % 1000000007) % 1000000007;
    a = a % 1000000007;
  }
  return result;
}
void debug(vector<long long int> v) {
  for (long long int i = 0; i < v.size(); ++i) {
    cerr << v[i] << " ";
  }
  cerr << "\n";
}
void print(vector<long long int> v) {
  for (long long int i = 0; i < v.size(); ++i) {
    cout << v[i] << " ";
  }
  cout << "\n";
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  long long int n;
  cin >> n;
  unordered_map<long long int, long long int> ma, mb, res;
  for (long long int i = 0; i < n; ++i) {
    long long int x;
    cin >> x;
    ma[--x] = i;
  }
  for (long long int i = 0; i < n; ++i) {
    long long int x;
    cin >> x;
    --x;
    long long int temp = (i - ma[x] + n) % n;
    res[temp]++;
  }
  long long int maxx = 0;
  for (auto x : res) {
    maxx = max(maxx, x.second);
  }
  cout << maxx << "\n";
}
