import java.util.*;
import java.io.*;

public class prefixstrings_stress {
	FastScanner in;
	PrintWriter out;

	public void solve() throws IOException {
		int n = in.nextInt();
		String s = in.next();
		int k = s.length();
		HashSet<String>[] count = new HashSet[n + 1];
		for (int i = 0; i <= n; i++) {
			count[i] = new HashSet<String>();
		}
		count[k].add(s);
		for (int i = k; i < n; i++) {
			for (String ss : count[i]) {
				for (int j = 1; j <= k; j++) {
					if (i + j <= n) {
						count[i + j].add(ss + ss.substring(0, j));
					}
				}
			}
		}
		out.println(count[n].size());
	}

	public void run() {
		try {
			in = new FastScanner(new File("prefixstrings.in"));
			out = new PrintWriter(new File("prefixstrings.out"));

			solve();

			out.close();
		} catch (IOException e) {
			e.printStackTrace();
		}
	}

	class FastScanner {
		BufferedReader br;
		StringTokenizer st;

		FastScanner(File f) {
			try {
				br = new BufferedReader(new FileReader(f));
			} catch (FileNotFoundException e) {
				e.printStackTrace();
			}
		}

		String next() {
			while (st == null || !st.hasMoreTokens()) {
				try {
					st = new StringTokenizer(br.readLine());
				} catch (IOException e) {
					e.printStackTrace();
				}
			}
			return st.nextToken();
		}

		int nextInt() {
			return Integer.parseInt(next());
		}

		long nextLong() {
			return Long.parseLong(next());
		}

		double nextDouble() {
			return Double.parseDouble(next());
		}

	}

	public static void main(String[] arg) {
		new prefixstrings_stress().run();
	}
}