#include <bits/stdc++.h>
using namespace std;
long long gcd(long long a, long long b) {
  if (b == 0) return a;
  return gcd(b, a % b);
}
long long binpow(long long a, long long b) {
  long long res = 1;
  while (b > 0) {
    if (b & 1) res = (res % 1000000007 * a % 1000000007) % 1000000007;
    a = (a % 1000000007 * a % 1000000007) % 1000000007;
    b >>= 1;
  }
  return res;
}
long long solve(long long p, long long q, long long r, long long a, long long b,
                long long c) {
  long long res = 0;
  if (p != q && p != 0 && ((a - b) % (p - q)) == 0) {
    long long x = (a - b) / (p - q);
    long long x1 = a - x * p;
    if (x == 1 && x1 == 0) {
      if (r == c) {
        return 0;
      } else {
        return 1;
      }
    }
    if (x == 1 && x1 != 0) {
      if (r + x1 == c || r == c) {
        return 1;
      } else {
        return 2;
      }
    }
    if (x != 1 && x1 == 0) {
      if (r * x == c || r == c) {
        return 1;
      } else {
        return 2;
      }
    }
    if (x != 1 && x1 != 0) {
      if (r * x + x1 == c || r == c) {
        return 2;
      } else {
        return 3;
      }
    }
  } else {
    if (p == q) {
      if (a == b) {
        if (a == p) {
          res = 0;
        } else {
          res = 1;
        }
      } else {
        res = 2;
      }
    } else {
      res = 2;
    }
    if (r == c) {
      return res;
    } else {
      return res + 1;
      ;
    }
  }
  return 0;
}
int32_t main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  ;
  int n;
  cin >> n;
  vector<int> a1(n + 1), b1(n + 1);
  map<int, int> mp, cnt;
  for (int i = (int)(1); i <= (int)(n); i++) {
    int x;
    cin >> x;
    mp[x] = i;
  }
  for (int i = (int)(1); i <= (int)(n); i++) {
    int x;
    cin >> x;
    int val = mp[x] - i;
    if (val < 0) {
      val += n;
    }
    cnt[val]++;
  }
  int maxi = 1;
  for (auto i : cnt) {
    maxi = max(maxi, i.second);
  }
  cout << maxi << "\n";
}
