Chris Martin

No attempts yetTime limit1sMemory limit128 MB

Problem

Last night the mad scientist Changho kidnapped Jaehyun Koo and extracted his DNA. Human DNA has length nn and consists of four bases: A, C, G, and T.

Changho dislikes Jaehyun, who always teased him, and instead prefers the handsome Chris Martin of Coldplay. From this he formed a theory: the DNA that is least similar to Jaehyun's DNA is Chris Martin's DNA.

The similarity of two DNA strings is defined as the length of their longest common subsequence (LCS). A subsequence of a DNA string is any string obtained by deleting zero or more bases from it, and the longest common subsequence of two DNA strings is a longest string that is a subsequence of both.

You, too, are currently kidnapped by Changho. If you cannot find Chris Martin's DNA, who knows what will happen. Given Jaehyun's DNA, among all DNA strings of the same length nn, find the minimum possible similarity to it. In other words, output the smallest LCS length that can occur between the given DNA and any DNA string TT of length nn.

Input

The first line contains the length nn of the human DNA. (1n100001 \le n \le 10000)

The second line contains a DNA string of length nn. Every character of the string is one of A, C, G, T.

Output

On the first line, print the minimum possible similarity, i.e. the smallest longest-common-subsequence length between the given DNA and any DNA string of length nn.