import java.util.Scanner;

public class ABB {

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

        int length = sc.nextInt();
        sc.nextLine();
        String input = sc.nextLine();
        StringBuilder sb = new StringBuilder(input);
        String revInput = sb.reverse().toString();

        if (input.equals(revInput)) {
            System.out.println(0);
            System.exit(0);
        }
        for (int k=1; k<length; ++k) {
            input = input.substring(1);
            revInput = revInput.substring(0, revInput.length()-1);
            if (input.equals(revInput)) {
                System.out.println(k);
                System.exit(0);
            }
        }

    }

}

