using System; using static System.Console; using System.Linq; using System.Collections.Generic; class Program { static int NN => int.Parse(ReadLine()); static int[] NList => ReadLine().Split().Select(int.Parse).ToArray(); static int[][] NArr(int n) => Enumerable.Repeat(0, n).Select(_ => NList).ToArray(); static void Main() { var n = NN; var s = ReadLine(); var set = new HashSet(); for (var i = 0; i + 1 < s.Length; ++i) { var key = 0L; if (s[i] == 'A') key += i + 1; if (s[i + 1] == 'A') { key = key * 1_000_000_000L + i + 2; } set.Add(key); } WriteLine(set.Count); } }