from collections import defaultdict
import sys
input=sys.stdin.readline
def main():
    n = int(input())
    a = [0] + list(map(int, input().strip().split())) 
    mp1 = defaultdict(int)
    mp = defaultdict(int) 
    t1 = 0
    t2 = 0
    for i in range(1, n // 2 + 1):
        if a[i] == a[n - i + 1]:
            mp1[a[i]] += 1
            t1 += 1
        else:
            mp[a[i]] += 1
            mp[a[n - i + 1]] += 1
            t2 += 1
 
    re = n
    for i in range(1, n + 1):
        q = 2 * mp1[a[i]] + 2 * mp[a[i]]
 
        if q >= (n + 2) // 2:
            re = min(re, t2) 
        else:
            to = (n + 2) // 2 - q 
            t3 = t2 - mp[a[i]] 
            t3 *= 2
            to += to % 2 
            if t3 + q >= (n + 2) // 2:
                re = min(re, mp[a[i]] + to + (t3 - to) // 2)
            else:
                res = mp[a[i]] + t3
                q += t3
                to = (n + 2) // 2 - q
                to += to % 2
                re = min(re, res + to)
 
    print(re)
 
if __name__ == "__main__":
    main()

