import java.util.Scanner;

public class ABB {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);

        int n = sc.nextInt();
        sc.nextLine();
        String slovo = sc.nextLine();

        StringBuilder slovicko = new StringBuilder(slovo);
        StringBuilder reversed = new StringBuilder(slovo);
        reversed = reversed.reverse();

        
        for (int i = 0; i < n; i++) {
            String substr = slovicko.substring(i);
            String mask = reversed.substring(0, n + 1 - Math.min(i + 1, n));

            if (substr.equals(mask)) {
                System.out.println(i);
                break;
            }
        }
    }
}



