import sys
def min_operations(n, s):
    min_ops = float('inf')
    
    # 尝试0到n-1次操作1(移动首字符到末尾)
    for k in range(n):
        # 生成移动k次后的字符串
        shifted_s = s[k:] + s[:k]
        ops1 = k  # 操作1的次数为k
        
        # 计算将shifted_s变为回文串需要的最小操作2次数
        ops2 = 0
        left, right = 0, n - 1
        while left < right:
            if shifted_s[left] != shifted_s[right]:
                ops2 += 1
            left += 1
            right -= 1
        
        # 更新最小操作次数
        total_ops = ops1 + ops2
        if total_ops < min_ops:
            min_ops = total_ops
    
    return min_ops

# 读取输入
n = int(input())
s = input().strip()

# 输出结果
print(min_operations(n, s))