#include <bits/stdc++.h>
using namespace std;
long long int mod = 998244353;
long long int hmaxii = 0;
vector<long long int> values[2 * 100000 + 1];
long long int MAXN = 2 * 100000 + 1;
long long int spf[2 * 100000 + 1];
long long int diff, x, y, z;
long long int flag = 1;
long long int price[1001][1001];
long long int dp[2000][2000];
long long int ans = 0;
long long int gcd(long long int a, long long int b) {
  return b ? gcd(b, a % b) : a;
}
long long int power(long long int a, long long int b) {
  if (b == 0) {
    return 1;
  }
  long long int temp = power(a, b / 2);
  temp = temp * temp;
}
void solution() {
  int n;
  cin >> n;
  int arr[n + 1];
  int brr[n + 1];
  for (int i = 1; i <= n; i++) {
    int x;
    cin >> x;
    arr[x] = i;
  }
  for (int i = 1; i <= n; i++) {
    int x;
    cin >> x;
    brr[x] = i;
  }
  int answer = 0;
  map<int, int> values;
  for (int i = 1; i <= n; i++) {
    values[(brr[i] - arr[i] + n) % n]++;
    answer = max(answer, values[(brr[i] - arr[i] + n) % n]);
  }
  cout << answer << endl;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  long long int t;
  t = 1;
  while (t--) {
    solution();
  }
  return 0;
}
