#include <bits/stdc++.h>
using namespace std;
using lint = long long;
template<class T = int> using V = vector<T>;
template<class T = int> using VV = V< V<T> >;


template<unsigned P> struct ModInt {
  using M = ModInt;
  unsigned v;
  ModInt() : v(0) {}
  template<class Z> ModInt(Z x) : v(x >= 0 ? x % P : -x % P ? P - -x % P : 0) {}
  constexpr ModInt(unsigned v, int) : v(v) {}
  static constexpr unsigned p() { return P; }
  M operator+() const { return *this; }
  M operator-() const { return {v ? P - v : 0, 0}; }
  explicit operator bool() const noexcept { return v; }
  bool operator!() const noexcept { return !(bool) *this; }
  M operator*(M r) const { return M(*this) *= r; }
  M operator/(M r) const { return M(*this) /= r; }
  M operator+(M r) const { return M(*this) += r; }
  M operator-(M r) const { return M(*this) -= r; }
  bool operator==(M r) const { return v == r.v; }
  bool operator!=(M r) const { return !(*this == r); }
  M& operator*=(M r) { v = (uint64_t) v * r.v % P; return *this; }
  M& operator/=(M r) { return *this *= r.inv(); }
  M& operator+=(M r) { v = r.v < P - v ? v + r.v : v - (P - r.v); return *this; }
  M& operator-=(M r) { v = r.v <= v ? v - r.v : v + (P - r.v); return *this; }
  M inv() const {
    int a = v, b = P, x = 1, u = 0;
    while (b) {
      int q = a / b;
      swap(a -= q * b, b);
      swap(x -= q * u, u);
    }
    assert(a == 1);
    return x;
  }
  template<class Z> M pow(Z n) const {
    n = n >= 0 ? n % (P - 1) : P - 1 - -n % (P - 1);
    M res = 1;
    for (M a = *this; n; a *= a, n >>= 1) if (n & 1) res *= a;
    return res;
  }
  template<class Z> friend M operator*(Z l, M r) { return M(l) *= r; }
  template<class Z> friend M operator/(Z l, M r) { return M(l) /= r; }
  template<class Z> friend M operator+(Z l, M r) { return M(l) += r; }
  template<class Z> friend M operator-(Z l, M r) { return M(l) -= r; }
  friend ostream& operator<<(ostream& os, M r) { return os << r.v; }
  friend istream& operator>>(istream& is, M& r) { lint x; is >> x; r = x; return is; }
  template<class Z> friend bool operator==(Z l, M r) { return M(l) == r; }
  template<class Z> friend bool operator!=(Z l, M r) { return !(l == r); }
};

template<class Z> Z rng(Z a, Z b) {
  static mt19937 mt(chrono::steady_clock::now().time_since_epoch().count());
  return uniform_int_distribution<Z>(a, b - 1)(mt);
}

struct RollingHash {
  using Mint0 = ModInt<(unsigned) 4e9 + 7>;
  using Mint1 = ModInt<(unsigned) 4e9 + 9>;
  static Mint0 B0;
  static Mint1 B1;
  static V<Mint0> powB0;
  static V<Mint1> powB1;
  const int n;
  V<Mint0> h0;
  V<Mint1> h1;
  template<class Itr> RollingHash(Itr first, Itr last) :
    n(distance(first, last)), h0(n + 1), h1(n + 1) {
    for (int i = 0; i < n; ++i, ++first) {
      h0[i + 1] = h0[i] * B0 + Mint0(*first);
      h1[i + 1] = h1[i] * B1 + Mint1(*first);
    }
    while (powB0.size() <= n) {
      powB0.push_back(powB0.back() * B0);
      powB1.push_back(powB1.back() * B1);
    }
  }
  Mint0 get0(int l, int r) { return h0[r] - h0[l] * powB0[r - l]; }
  Mint1 get1(int l, int r) { return h1[r] - h1[l] * powB1[r - l]; }
  bool eq(int l0, int r0, int l1, int r1) {
    return get0(l0, r0) == get0(l1, r1) and get1(l0, r0) == get1(l1, r1);
  }
  template<class Itr> static Mint0 get0(Itr first, Itr last) {
    Mint0 res;
    while (first != last) {
      res = res * B0 + Mint0(*first++);
    }
    return res;
  }
  template<class Itr> static Mint1 get1(Itr first, Itr last) {
    Mint1 res;
    while (first != last) {
      res = res * B1 + Mint1(*first++);
    }
    return res;
  }
};
RollingHash::Mint0 RollingHash::B0 = rng<unsigned>(1, RollingHash::Mint0::p());
RollingHash::Mint1 RollingHash::B1 = rng<unsigned>(1, RollingHash::Mint1::p());
V<RollingHash::Mint0> RollingHash::powB0{1};
V<RollingHash::Mint1> RollingHash::powB1{1};

int main() {
  cin.tie(nullptr); ios::sync_with_stdio(false);
  int n; cin >> n;
  string s; cin >> s;
  RollingHash rh(begin(s), end(s)), rev(rbegin(s), rend(s));
  auto chk = [&](int k) -> bool {
    int t = 2 * k - 2;
    if (n <= t) {
        return rh.get0(2 * k - n - 1, k - 1) == rev.get0(0, n - k) and rh.get1(2 * k - n - 1, k - 1) == rev.get1(0, n - k);
    }
    if (rh.get0(0, k) != rev.get0(n - t - 1, n - k + 1) or rh.get1(0, k) != rev.get1(n - t - 1, n - k + 1)) return false;
    for (int i = 0; i < n; i += t) {
        int w = min(t, n - i);
        if (!rh.eq(0, w, i, i + w)) return false;
    }
    return true;
  };
  for (int k = 2; k <= n; ++k) {
    if (chk(k)) return cout << k << "\n", 0;
  }
}


Measured memory_bytes: 28676