/*
    Valkyrie
                                                //
                                              ,//
                                  ___   /|   |//
                              `__/\_ --(/|___/-/
                           \|\_-\___ __-_`- /-/ \.
                          |\_-___,-\_____--/_)' )                            \ -_ /     __ \( `( __`\|
                           `\__|      |\)\ ) /(/|
   ,._____.,            ',--//-|      \  |  '   /
  /     __. \,          / /,---|       \       /
 / /    _. \  \        `/`_/ _,'        |     |
|  | ( (  \   |      ,/\'__/'/          |     |
|  \  \`--, `_/_------______/           \(   )/
| | \  \_. \,                            \___/| |  \_   \  \                                 \ \    \_ \   \   /                              \ \  \._  \__ \_|       |                         \ \___  \      \       |                           \__ \__ \  \_ |       \                         |
   |  \_____ \  ____      |                        |
   | \  \__ ---' .__\     |        |               |
   \  \__ ---   /   )     |        \              /
    \   \____/ / ()(      \          `---_       /|
     \__________/(,--__    \_________.    |    ./ |
       |     \ \  `---_\--,           \   \_,./   |
       |      \  \_ ` \    /`---_______-\   \\    /
        \      \.___,`|   /              \   \\            \     |  \_ \|   \              (   |:    |
          \    \      \    |             /  / |    ;
           \    \      \    \          ( `_'   \  |
            \.   \      \.   \          `__/   |  |
              \   \       \.  \                |  |
               \   \        \  \               (  )
                \   |        \  |              |  |
                 |  \         \ \              I  `
                 ( __;        ( _;            ('-_';
                 |___\        \___:            \___:



                 ,,ggddY888Ybbgg,,
          ,agd8""'   .d8888888888bga,
       ,gdP""'     .d88888888888888888g,
     ,dP"        ,d888888888888888888888b,
   ,dP"         ,8888888888888888888888888b,
  ,8"          ,8888888P"""88888888888888888,
 ,8'           I888888I    )88888888888888888,
,8'            `8888888booo8888888888888888888,
d'              `88888888888888888888888888888b
8                `"8888888888888888888888888888
8                  `"88888888888888888888888888
8                      `"8888888888888888888888
Y,                        `8888888888888888888P
`8,                         `88888888888888888'
 `8,              .oo.       `888888888888888'
  `8a             8888        88888888888888'
   `Yba           `""'       ,888888888888P'
     "Yba                   ,88888888888'
       `"Yba,             ,8888888888P"'
          `"Y8baa,      ,d88888888P"'
               ``""YYba8888P888"'     $/              
           __                        O$               
       _.-"  )                        $'              
    .-"`. .-":        o      ___     ($o              
 .-".-  .'   ;      ,st+.  .' , \    ($               
:_..-+""    :       T   "^T==^;\;;-._ $\              
   """"-,   ;       '    /  `-:-// / )$/              
        :   ;           /   /  :/ / /dP               
        :   :          /   :    )^-:_.l               
        ;    ;        /    ;    `.___, \           .-,
       :     :       :  /  ;.q$$$$$$b   \$$$p,    /  ;
       ;   :  ;      ; :   :$$$$$$$$$b   T$$$$b .'  / 
       ;   ;  :      ;   _.:$$$$$$$$$$    T$$P^"   /l 
       ;.__L_.:   .q$;  :$$$$$$$$$$$$$;_   TP .-" / ; 
       :$$$$$$;.q$$$$$  $$$$$$$$$$$$$$$$b  / /  .' /  
        $$$$$$$$$$$$$;  $$$$$$$$P^" "^Tb$b/   .'  :   
        :$$$$$$$$$$$$;  $$$$P^jp,      `$$_.+'    ;   
        $$$$$$$$$$$$$;  :$$$.d$$;`- _.-d$$ /     :    
        '^T$$$$$P^^"/   :$$$$$$P      d$$;/      ;    
                   :    $$$$$$P"-. .--$$P/      :     
                   ;    $$$$P'( ,    d$$:b     .$     
                   :    :$$P .-dP-'  $^'$$bqqpd$$     
                    `.   "" ' s")  .'  d$$$$$$$$'     
                      \           /;  :$$$$$$$P'      
                    _  "-, ;       '.  T$$$$P'        
                   / "-.'  :    .--.___.`^^'          
                  /      . :  .'                      
                  ),sss.  \  :  bug                   
                 : TP""Tb. ; ;                        
                 ;  Tb  dP   :                        
                 :   TbdP    ;                        
                  \   $P    /                         
                   `-.___.-'
*/
#include <bits/stdc++.h>
#define sqr(x) (x * x)
#define cub(x) sqr(x) * (x)
#define all(x) x.begin() , x.end()
#define fp pop_front
#define bp pop_back
#define pf push_front
#define pb push_back
#define mp make_pair
#define sz size()                                                           
#define se second             
#define fi first
#define _ std::ios_base::sync_with_stdio(false); std::cin.tie(0); std::cout.tie(0);
using namespace std;
typedef long long ll;
typedef double dd;
typedef string st;
typedef char ch;
typedef unsigned long long ull;
typedef bool bl;
typedef long double ld;
typedef int I;
const ld pi = 3.14159265358979323846;                              	
const ll mod = 1e9 + 7;
const ll N = 5e5;
const ll INF = 1e9 + 1;
int n, a[N], b[N], c[N], mx1, mx2, lol1, lol2, mx11, mx22;
int main () { _
    cin >> n;
    for (int i = 1; i <= n; ++i) {
        cin >> a[i];
        if (i % 2) 
            b[a[i]]++;
        else
            c[a[i]]++;
    }
    for (int i = 1; i <= n; ++i) 
        if (b[a[i]] > mx1) {
            mx1 = b[a[i]];
            lol1 = a[i];
        }
    b[lol1] = 0;
    for (int i = 1; i <= n; ++i) 
        if (b[a[i]] > mx11) 
            mx11 = b[a[i]];
    for (int i = 1; i <= n; ++i) 
        if (c[a[i]] > mx2) {
            mx2 = c[a[i]];
            lol2 = a[i];
        }
    c[lol2] = 0;
    for (int i = 1; i <= n; ++i) 
        if (c[a[i]] > mx22) 
            mx22 = c[a[i]];
    // cout << mx1 << " " << mx2 << endl;
    if (lol1 == lol2) 
        if (mx1 < mx2) {
            cout << 1 << endl;
            if (n % 2) {
                n /= 2;
                cout << n + 1 - mx11 + n - mx2; 
            } else {
                n /= 2;
                cout << n - mx11 + n - mx2;
            }
        } else if (mx2 < mx1) {
            cout << 2 << endl;
            if (n % 2) {
                n /= 2;
                cout << n + 1 - mx1 + n - mx22;
            } else {
                n /= 2;
                cout << n - mx1 + n - mx22; 
            }
        } else {
            if (mx11 > mx22) {
                if (n % 2) {
                    n /= 2;
                    cout << n + 1 - mx11 + n - mx2; 
                } else {
                    n /= 2;
                    cout << n - mx11 + n - mx2;
                }    
            } else {
                if (n % 2) {
                    n /= 2;
                    cout << n + 1 - mx1 + n - mx22;
                } else {
                    n /= 2;
                    cout << n - mx1 + n - mx22; 
                }    
            }
        }
    else {
        // cout << n << endl;
        n /= 2;
        // cout << 3 << endl;
        cout << n - mx1 + n - mx2;
    }
    return 0;
}

Measured memory_bytes: 2944