#include<bits/stdc++.h>
#include <unordered_map>
using namespace std;
#define MAXV 2147483647
#define MINV -2147483647
typedef int ll;
typedef pair<ll, ll> pi;
typedef vector<pi> vii;
typedef vector<ll> vi;
#define pb push_back
#define error 1e-9
#define sz(a) ll((a).size())
#define all(c) (c).begin(),(c).end()
#define input ({ll n; scanf("%d", &n);    n;})
#define fori(i, a, b) for (ll i = ll(a); i < ll(b); i++)
#define syc ios_base::sync_with_stdio(0); cin.tie(0)
#define mem(a, s) memset(a, s, sizeof (a))
#define fr freopen("/Users/naveen/Documents/cp/input.txt","r",stdin)
#define fw freopen("/Users/naveen/Documents/cp/output.txt","w",stdout)
const int mod = 1000000007;
#define PI 3.1415926535897932384626
const int N = 3e5;
int main(int argc, char const *argv[])
{
	syc;
	int n;
    cin>>n;
    int arr[n];
    arr[0]=0;
    fori(i,1,n+1){
        cin>>arr[i];
    }

    sort(arr+1,arr+n+1);
    double res=0;
    for(int i = 1 ; i<= n ; i+=2){
        res+=(double)(pow(arr[i],2)-pow(arr[i-1],2));
        // cout<<pow(arr[i],2)<<"Hi"<<pow(arr[i-1],2)<<endl;
    }
    cout<<res<<endl;
    res=res*PI;
    // cout<<res<<endl;
    printf("%.10f",res);
	return 0;
}


#include<bits/stdc++.h>
#include <unordered_map>
using namespace std;
#define MAXV 2147483647
#define MINV -2147483647
typedef int ll;
typedef pair<ll, ll> pi;
typedef vector<pi> vii;
typedef vector<ll> vi;
#define pb push_back
#define error 1e-9
#define sz(a) ll((a).size())
#define all(c) (c).begin(),(c).end()
#define input ({ll n; scanf("%d", &n);    n;})
#define fori(i, a, b) for (ll i = ll(a); i < ll(b); i++)
#define syc ios_base::sync_with_stdio(0); cin.tie(0)
#define mem(a, s) memset(a, s, sizeof (a))
#define fr freopen("/Users/naveen/Documents/cp/input.txt","r",stdin)
#define fw freopen("/Users/naveen/Documents/cp/output.txt","w",stdout)
const int mod = 1000000007;
#define PI 3.1415926535897932384626
const int N = 3e5;
int main(int argc, char const *argv[])
{
	syc;
	int n;
    cin>>n;
    int arr[n];
    arr[0]=0;
    fori(i,1,n+1){
        cin>>arr[i];
    }

    sort(arr+1,arr+n+1);
    double res=0;
    for(int i = 1 ; i<= n ; i+=2){
        res+=(double)(pow(arr[i],2)-pow(arr[i-1],2));
        // cout<<pow(arr[i],2)<<"Hi"<<pow(arr[i-1],2)<<endl;
    }
    //cout<<res<<endl;
    res=res*PI;
    // cout<<res<<endl;
    printf("%.10f",res);
	return 0;
}


 #include<bits/stdc++.h>
#include <unordered_map>
using namespace std;
#define MAXV 2147483647
#define MINV -2147483647
typedef int ll;
typedef pair<ll, ll> pi;
typedef vector<pi> vii;
typedef vector<ll> vi;
#define pb push_back
#define error 1e-9
#define sz(a) ll((a).size())
#define all(c) (c).begin(),(c).end()
#define input ({ll n; scanf("%d", &n);    n;})
#define fori(i, a, b) for (ll i = ll(a); i < ll(b); i++)
#define syc ios_base::sync_with_stdio(0); cin.tie(0)
#define mem(a, s) memset(a, s, sizeof (a))
#define fr freopen("/Users/naveen/Documents/cp/input.txt","r",stdin)
#define fw freopen("/Users/naveen/Documents/cp/output.txt","w",stdout)
const int mod = 1000000007;
#define PI 3.1415926535897932384626
const int N = 3e5;
int main(int argc, char const *argv[])
{
	syc;
	int n;
    cin>>n;
    int arr[n];
    arr[0]=0;
    fori(i,1,n+1){
        cin>>arr[i];
    }

    sort(arr+1,arr+n+1);
    double res=0;
    for(int i = n ; i>=1 ; i-=2){
        res+=(double)(pow(arr[i],2)-pow(arr[i-1],2));
        // cout<<pow(arr[i],2)<<"Hi"<<pow(arr[i-1],2)<<endl;
    }
    cout<<res<<endl;
    res=res*PI;
    // cout<<res<<endl;
    printf("%.10f",res);
	return 0;
}


 #include<bits/stdc++.h>
#include <unordered_map>
using namespace std;
#define MAXV 2147483647
#define MINV -2147483647
typedef int ll;
typedef pair<ll, ll> pi;
typedef vector<pi> vii;
typedef vector<ll> vi;
#define pb push_back
#define error 1e-9
#define sz(a) ll((a).size())
#define all(c) (c).begin(),(c).end()
#define input ({ll n; scanf("%d", &n);    n;})
#define fori(i, a, b) for (ll i = ll(a); i < ll(b); i++)
#define syc ios_base::sync_with_stdio(0); cin.tie(0)
#define mem(a, s) memset(a, s, sizeof (a))
#define fr freopen("/Users/naveen/Documents/cp/input.txt","r",stdin)
#define fw freopen("/Users/naveen/Documents/cp/output.txt","w",stdout)
const int mod = 1000000007;
#define PI 3.1415926535897932384626
const int N = 3e5;
int main(int argc, char const *argv[])
{
	syc;
	int n;
    cin>>n;
    int arr[n];
    arr[0]=0;
    fori(i,1,n+1){
        cin>>arr[i];
    }

    sort(arr+1,arr+n+1);
    double res=0;
    for(int i = n ; i>=1 ; i-=2){
        res+=(double)(pow(arr[i],2)-pow(arr[i-1],2));
        // cout<<pow(arr[i],2)<<"Hi"<<pow(arr[i-1],2)<<endl;
    }
    //cout<<res<<endl;
    res=res*PI;
    // cout<<res<<endl;
    printf("%.10f",res);
	return 0;
}


#include<bits/stdc++.h>
using namespace std;

#define pi 3.1415926536
template<class T> inline T sqr(T x){return x*x;}
int n;
vector<int> v;

int main(){
    ios::sync_with_stdio(0);
    cin.tie(0);
    cin>>n;
    for(int i=0;i<n;i++){
        int r;
        cin>>r;
        v.push_back(r);
    }
    sort(v.begin(),v.end(),greater<int>());
    double ans = 0.0;
    for(int i=0;i<v.size();i+=2){
        double val = pi * (double)(sqr(v[i])-sqr(v[i+1]));
        ans += val;
    }
    cout<<fixed<<setprecision(12);
    cout<<ans<<"\n";
    return 0;
}


#include<bits/stdc++.h>
using namespace std;

#define pi 3.1415926536
template<class T> inline T sqr(T x){return x*x;}
int n;
vector<int> v;

int main(){
    ios::sync_with_stdio(0);
    cin.tie(0);
    cin>>n;
    for(int i=0;i<n;i++){
        int r;
        cin>>r;
        v.push_back(r);
    }
    sort(v.begin(),v.end());
    long long ans = 0;
    for(int i=0;i<v.size();i+=2){
        double val = ((v[i]*v[i])-(v[i+1]*v[i+1]));
        ans += val;
    }
    cout<<ans*pi<<"\n";
    return 0;
}


#include<bits/stdc++.h>
using namespace std;

#define pi 3.1415926536
template<class T> inline T sqr(T x){return x*x;}
int n;
vector<int> v;

int main(){
    ios::sync_with_stdio(0);
    cin.tie(0);
    cin>>n;
    for(int i=0;i<n;i++){
        int r;
        cin>>r;
        v.push_back(r);
    }
    sort(v.begin(),v.end());
    double ans = 0.0;
    for(int i=0;i<v.size();i+=2){
        double val = pi *((v[i]*v[i])-(v[i+1]*v[i+1]));
        ans += val;
    }
    cout<<fixed<<setprecision(12);
    cout<<ans<<"\n";
    return 0;
}


#include<bits/stdc++.h>
using namespace std;

template<class T> inline T sqr(T x){return x*x;}
int n;
vector<int> v;
double ans,pi;

int main(){
    ios::sync_with_stdio(0);
    cin.tie(0);
    pi =3.141592653589793;
    cin>>n;
    for(int i=0;i<n;i++){
        int r;
        cin>>r;
        v.push_back(r);
    }
    sort(v.begin(),v.end());

    for(int i=v.size()-1;i>=0;i-=2){
        ans += pi *((v[i]*v[i])-(v[i-1]*v[i-1]));
    }

    cout<<ans<<"\n";
    return 0;
}


#include<bits/stdc++.h>
using namespace std;

template<class T> inline T sqr(T x){return x*x;}
int n,a[107];
double ans,pi;

int main(){
    ios::sync_with_stdio(0);
    cin.tie(0);
    pi =3.141592653589793;
    cin>>n;
    for(int i=1;i<=n;i++) cin>>a[i];

    sort(a,a+n+1);

    for(int i=n;i>=0;i-=2){
        ans = ans + pi * ((a[i]*a[i])-(a[i-1]*a[i-1]));
    }

    cout<<ans<<"\n";
    return 0;
}


#include<bits/stdc++.h>
using namespace std;

const double pi=acos(-1.0);
template<class T> inline T sqr(T x){return x*x;}
int n;
vector<int> v;

int main(){
    ios::sync_with_stdio(0);
    cin.tie(0);
    cin>>n;
    for(int i=0;i<n;i++){
        int r;
        cin>>r;
        v.push_back(r);
    }
    sort(v.begin(),v.end(),greater<int>());
    double ans = 0.0;
    for(int i=0;i<v.size();i+=2){
        double val = pi * (double)(sqr(v[i])-sqr(v[i+1]));
        ans += val;
    }
    cout<<fixed<<setprecision(12);
    cout<<ans<<"\n";
    return 0;
}


#include<bits/stdc++.h>
using namespace std;

template<class T> inline T sqr(T x){return x*x;}
int n;
vector<int> v;
double ans,pi;

int main(){
    ios::sync_with_stdio(0);
    cin.tie(0);
    pi = 3.1415926536;
    cin>>n;
    for(int i=0;i<n;i++){
        int r;
        cin>>r;
        v.push_back(r);
    }
    sort(v.begin(),v.end());

    for(int i=0;i<v.size();i+=2){
        ans += pi *((v[i]*v[i])-(v[i+1]*v[i+1]));
    }
    cout<<fixed<<setprecision(12);
    cout<<ans<<"\n";
    return 0;
}


#include<bits/stdc++.h>
using namespace std;

template<class T> inline T sqr(T x){return x*x;}
int n;
vector<int> v;
double ans,pi;

int main(){
    ios::sync_with_stdio(0);
    cin.tie(0);
    p=3.141592653589793;
    cin>>n;
    for(int i=0;i<n;i++){
        int r;
        cin>>r;
        v.push_back(r);
    }
    sort(v.begin(),v.end());

    for(int i=v.size()-1;i>=0;i-=2){
        ans += pi *((v[i]*v[i])-(v[i-1]*v[i-1]));
    }

    cout<<ans<<"\n";
    return 0;
}


#include<bits/stdc++.h>
using namespace std;

template<class T> inline T sqr(T x){return x*x;}
int n;
vector<int> v;
double ans,pi;

int main(){
    ios::sync_with_stdio(0);
    cin.tie(0);
    pi = 3.1415926536;
    cin>>n;
    for(int i=0;i<n;i++){
        int r;
        cin>>r;
        v.push_back(r);
    }
    sort(v.begin(),v.end(),greater<int>());

    for(int i=0;i<v.size();i+=2){
        ans += pi *((v[i]*v[i])-(v[i+1]*v[i+1]));
    }
    cout<<fixed<<setprecision(12);
    cout<<ans<<"\n";
    return 0;
}


#include<bits/stdc++.h>
using namespace std;

#define pi 3.1415926536
template<class T> inline T sqr(T x){return x*x;}
int n;
vector<int> v;

int main(){
    ios::sync_with_stdio(0);
    cin.tie(0);
    cin>>n;
    for(int i=0;i<n;i++){
        int r;
        cin>>r;
        v.push_back(r);
    }
    sort(v.begin(),v.end());
    double ans = 0.0;
    for(int i=0;i<v.size();i+=2){
        double val = pi * (double)((v[i]*v[i])-(v[i+1]*v[i+1]));
        ans += val;
    }
    cout<<fixed<<setprecision(12);
    cout<<ans<<"\n";
    return 0;
}


#include <bits/stdc++.h>
using namespace std;
const double PI = acos(-1);
int main ()
{
    int n;
    double r[111] , ans = 0;
    cin >> n;
    r[0] = 0;
    for (int i = 0 ; i < n ; i++) cin >> r[i + 1];
    sort(r , r + (n + 1));
    for (int i = 0 ; i < n ; i += 2)
    {
        ans += (r[i + 1] * r[i + 1] - r[i] * r[i]);
    }
    cout << fixed << setprecision(10) << ans * PI;
}


#include <bits/stdc++.h>
using namespace std;
const double PI = acos(-1);
int main ()
{
    int n;
    long double r[111] , ans1 = 0 , ans2 = 0;
    cin >> n;
    r[0] = 0;
    for (int i = 0 ; i < n ; i++) cin >> r[i + 1];
    sort(r , r + (n + 1));
    for (int i = 0 ; i < n ; i ++)
    {
        if (i % 2 == 0) ans1 += (r[i + 1] * r[i + 1] - r[i] * r[i]);
        else ans2 += (r[i + 1] * r[i + 1] - r[i] * r[i]);
    }
    if (n % 2 == 0) cout << fixed << setprecision(10) << ans2 * PI;
    else cout << fixed << setprecision(10) << ans1 * PI;
}


#include <bits/stdc++.h>
using namespace std;
const double PI = acos(-1);
int main ()
{
    int n;
    double r[111] , ans1 = 0 , ans2 = 0;
    cin >> n;
    r[0] = 0;
    for (int i = 0 ; i < n ; i++) cin >> r[i + 1];
    sort(r , r + (n + 1));
    for (int i = 0 ; i < n ; i ++)
    {
        if (i % 2 == 0) ans1 += (r[i + 1] * r[i + 1] - r[i] * r[i]);
        else ans2 += (r[i + 1] * r[i + 1] - r[i] * r[i]);
    }
    cout << fixed << setprecision(10) << max(ans1 , ans2) * PI;
}


#include <stdio.h>
#include <math.h>
#include <algorithm>
using namespace std;

#define pb push_back
#define mk make_pair
#define fr first
#define sc second

typedef __int64 ll;

const int maxn = 100100;

int n;
int a[maxn];
int s;
void solve(){
    scanf("%d", &n);
    for(int i = 0; i < n; i ++) scanf("%d", a + i);
    sort(a, a + n);
    for(int i = 0; i < n; i ++){
        if(i % 2 == 0) s += a[i] * a[i];
        else
            s -= a[i]*a[i];
    }
    printf("%.10lf", 1.0* s * M_PI);
}

int main(){
    solve();
}


#include <bits/stdc++.h>

using namespace std;

#define pb push_back
#define mk make_pair
#define fr first
#define sc second

typedef __int64 ll;

const int maxn = 100100;

int n;
int a[maxn];
int s;
void solve(){
    scanf("%d", &n);
    for(int i = 0; i < n; i ++) scanf("%d", a + i);
    sort(a, a + n);
    for(int i = 0; i < n; i ++){
        if(i % 2 == 0) s += a[i] * a[i];
        else
            s -= a[i]*a[i];
    }
    printf("%.10lf", 1.0* s * M_PI);
}

int main(){
    solve();
}


#include <stdio.h>
#include <math.h>
#include <algorithm>
using namespace std;

#define pb push_back
#define mk make_pair
#define fr first
#define sc second

typedef __int64 ll;

const int maxn = 100100;

int n;
int a[maxn];
double s;
void solve(){
    scanf("%d", &n);
    for(int i = 0; i < n; i ++) scanf("%d", a + i);
    sort(a, a + n);

    for(int i = n - 1; i >= 0; i -= 2){
        s += 1.0 * a[i] * a[i] * acos(-1.0);
    }
    for(int i = n - 2; i >= 0 ; i -= 2)
        s -= 1.0 * a[i] * a[i] * acos(-1.0);
    printf("%.10lf", s);
}

int main(){
    solve();
}


#include <stdio.h>
#include <math.h>
#include <algorithm>
using namespace std;

#define pb push_back
#define mk make_pair
#define fr first
#define sc second

typedef __int64 ll;

const int maxn = 100100;

int n;
int a[maxn];
int s;
void solve(){
    scanf("%d", &n);
    for(int i = 0; i < n; i ++) scanf("%d", a + i);
    sort(a, a + n);
    for(int i = 0; i < n; i ++){
        if(i % 2 == 0) s += 1ll * a[i] * a[i];
        else
        if(i != n - 1)
            s -= 1ll * a[i]*a[i];
    }
    printf("%.10lf", 1.0 * s * acos(-1.0));
}

int main(){
    solve();
}


#include <stdio.h>
#include <math.h>
#include <algorithm>
using namespace std;

#define pb push_back
#define mk make_pair
#define fr first
#define sc second

typedef __int64 ll;

const int maxn = 100100;

int n;
int a[maxn];
int s;
void solve(){
    scanf("%d", &n);
    for(int i = 0; i < n; i ++) scanf("%d", a + i);
    sort(a, a + n);
    for(int i = 0; i < n; i ++){
        if(i % 2 == 0) s += a[i] * a[i];
        else
            s -= a[i]*a[i];
    }
    printf("%.10lf", 1.0* s * acos(-1));
}

int main(){
    solve();
}


#include <stdio.h>
#include <math.h>
#include <algorithm>
using namespace std;

#define pb push_back
#define mk make_pair
#define fr first
#define sc second

typedef __int64 ll;

const int maxn = 100100;

int n;
int a[maxn];
int s;
void solve(){
    scanf("%d", &n);
    for(int i = 0; i < n; i ++) scanf("%d", a + i);
    sort(a, a + n);
    for(int i = 0; i < n; i ++){
        if(i % 2 == 0) s += 1ll * a[i] * a[i];
        else
            s -= 1ll * a[i]*a[i];
    }
    printf("%.10lf", 1.0 * s * acos(-1.0));
}

int main(){
    solve();
}


#include <algorithm>
#include <iostream>
#include <cstdio>
#include <cmath>
#include <string>
#include <map>
using namespace std;
typedef long long ll;
const int N=1001000;
const double pie=3.1415926535;
int main(){

	ios::sync_with_stdio(false);
	int n; double a[110];
	scanf("%d",&n);
	for(int i=1;i<=n;i++) scanf("%lf",&a[i]);
	sort(a+1,a+n+1);
	double sum=0;
	for(int i=1;i<=n;i=i+2){
		if(i==1) sum=a[i]*a[i]+sum;
		else{
             	 sum=sum+(a[i]*a[i]-a[i-1]*a[i-1]);
		}
	}
	printf("%.10f\n",sum*pie);

}


#include <algorithm>
#include <iostream>
#include <cstdio>
#include <cmath>
#include <string>
#include <map>
using namespace std;
typedef long long ll;
const int N=1001000;
const double pie=3.1415926535;
int main(){

	ios::sync_with_stdio(false);
	int n; double a[110];
	scanf("%d",&n);
	for(int i=1;i<=n;i++) scanf("%lf",&a[i]);
	sort(a+1,a+n+1);
	double sum=0;
	if(n&1){
		for(int i=1;i<=n;i=i+2){
		if(i==1) sum=a[i]*a[i]+sum;
		else{
             	 sum=sum+(a[i]*a[i]-a[i-1]*a[i-1]);
		}
	}

	}
	else{
		for(int i=2;i<=n;i=i+2){

			 sum=sum+(a[i]*a[i]-a[i-1]*a[i-1]);
	}

	}

	printf("%.10f\n",sum*pie);

}


#include <algorithm>
#include <iostream>
#include <cstdio>
#include <cmath>
#include <string>
#include <cstring>
#include <map>
using namespace std;
typedef long long ll;
const int N=1001000;
int main(){

	double a[10],S;
	for(int i=1;i<=6;i++) scanf("%lf",&a[i]);
	for(int i=1;i<=3;i++){
		S=S+0.5*a[2*i]*a[2*i-1]*0.5*sqrt(3.0);
	}
	double b[10],p=0;
	for(int i=1;i<=3;i++){
		b[i]=sqrt(a[2*i]*a[2*i]+a[2*i-1]*a[2*i-1]+a[2*i]*a[2*i-1]);
		p=p+b[i];
	}
	p=p/2.0;
	S=S+sqrt(p*(p-b[1])*(p-b[2])*(p-b[3]));
	double m=(4.0*S/(sqrt(3.0))+0.5);
	printf("%d",(int)m);

return 0;

}


#include<bits/stdc++.h>
#define f float
const double PI = 3.141592654;
using namespace std;

int main()
{
	int n; cin>>n;
	int a[n+5];
	for(int i=0;i<n;i++){
		cin>>a[i];
	}
	if(n==1){
		cout<<(f)a[0]*a[0]*PI;
		return 0;
	}
	else{
		sort(a,a+n);
		if(n%2==0){
			f dem=0;
			for(int i=0;i<n-1;i++){
				if(i%2==0){
					dem+=(f)a[i]*a[i]*PI;
				}
	    		else{
		    		dem-=(f)a[i]*a[i]*PI;
    			}
    		}
    		cout<<dem;
    	}
    	else{
    		f dem=0;
    		for(int i=0;i<n;i++){
	    		if(i%2==0){
    				dem+=(f)a[i]*a[i]*PI;
    			}
	    		else{
	    			dem-=a[i]*a[i]*PI;
    			}
    		}
    		cout<<dem;
	    }
    }
}


def main():
    first_line = raw_input().split()
    n = int(first_line[0])
    m = int(first_line[1])
    a = [int(x) for x in raw_input().split()]
    # print "a[-1]", a[-1]
    l = []

    for i in range(m):
        l.append(int(raw_input()) - 1)

    ss = []
    s = {a[-1]}

    for i in reversed(a):
        s = s.union({i})
        ss.append(len(s))

    ss.reverse()

    r = []

    for i in l:
        r.append(str(ss[i]))

    print "\n".join(r)

main()


def main():
    first_line = raw_input().split()
    n = int(first_line[0])
    m = int(first_line[1])
    a = [int(x) for x in raw_input().split()]
    # print "a[-1]", a[-1]
    l = []

    for i in xrange(m):
        l.append(int(raw_input()) - 1)

    ss = []
    s = {a[-1]}

    for i in reversed(a):
        s.add(i)
        ss.append(len(s))

    ss.reverse()

    r = []

    for i in l:
        r.append(str(ss[i]))

    print "\n".join(r)

main()


#!/usr/bin/env pypy
from __future__ import division, print_function
from collections import defaultdict, Counter, deque
from future_builtins import ascii, filter, hex, map, oct, zip
from itertools import imap as map, izip as zip
from itertools import permutations
from __builtin__ import xrange as range
from math import ceil
from _continuation import continulet
from cStringIO import StringIO
from io import IOBase
import __pypy__
from math import log, ceil
from bisect import bisect, insort, bisect_left, bisect_right
import heapq
import sys
import os
import re
inf = float('inf')
mod = int(1e9) + 7
mod_ = 998244353

'''
Check for special cases (n=1)
One wrong submission = 10 mins penalty!
do smth instead of nothing and stay organized
'''
import math

def main():
    n,m=map(int,input().split())
    arr=list(map(int,input().split()))
    vis=set([])
    pre=[0 for i in range(n-1)]+[1]
    vis.add(arr[-1])
# print(pre)
    for i in range(n-2,-1,-1):
        if arr[i] in vis:
            pre[i]=pre[i+1]
        else:
            pre[i]=pre[i+1]+1
        vis.add(arr[i])
    # print(arr[i],pre)
    for i in range(m):
        x=int(input())
        print(pre[x-1])
# print(pre)

BUFSIZE = 8192
class FastI(IOBase):
    def __init__(self, file):
        self._fd = file.fileno()
        self._buffer = StringIO()
        self.newlines = 0

    def read(self):
        while True:
            b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
            if not b:
                break
            ptr = self.buffer.tell()
            self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr)
        self.newlines = 0
        return self.buffer.read()

    def readline(self):
        while self.newlines == 0:
            b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
            self.newlines = b.count("\n") + (not b)
            ptr = self._buffer.tell()
            self._buffer.seek(0, 2), self._buffer.write(
                b), self._buffer.seek(ptr)
        self.newlines -= 1
        return self._buffer.readline()
class FastO(IOBase):
    def __init__(self, file):
        self._fd = file.fileno()
        self._buffer = __pypy__.builders.StringBuilder()
        self.write = lambda s: self._buffer.append(s)

    def flush(self):
        os.write(self._fd, self._buffer.build())
        self._buffer = __pypy__.builders.StringBuilder()
def print(*args, **kwargs):
    sep, file = kwargs.pop("sep", " "), kwargs.pop("file", sys.stdout)
    at_start = True
    for x in args:
        if not at_start:
            file.write(sep)
        file.write(str(x))
        at_start = False
    file.write(kwargs.pop("end", "\n"))
    if kwargs.pop("flush", False):
        file.flush()
def gcd(x, y):
    while y:
        x, y = y, x % y
    return x
sys.stdin, sys.stdout = FastI(sys.stdin), FastO(sys.stdout)
def input(): return sys.stdin.readline().rstrip("\r\n")
if __name__ == "__main__":
    def bootstrap(cont):
        call, arg = cont.switch()
        while True:
            call, arg = cont.switch(to=continulet(
                lambda _, f, args: f(*args), call, arg))
    cont = continulet(bootstrap)
    cont.switch()
    main()


if __name__ == '__main__':
    n, m = [int(num) for num in raw_input().split()]
    A = [int(num) for num in raw_input().split()]

    nb_distincts, distincts = [1]*n, [False]*100001
    distincts[A[-1]] = True # last element has to be distinct
    for i in reversed(range(n-1)):
        a = A[i]

        distinct = distincts[a] == False
        nb_distincts[i] = distinct + nb_distincts[i+1]
        distincts[a] = True

    for _ in range(m):
        q = int(raw_input())
        print nb_distincts[q-1]


if __name__ == '__main__':
    n, m = [int(num) for num in raw_input().split()]
    A = [int(num) for num in raw_input().split()]

    nb_distincts, distincts = [1]*n, [False]*15
    distincts[A[-1]] = True # last element has to be distinct
    for i in reversed(range(n-1)):
        a = A[i]

        distinct = distincts[a] == False
        nb_distincts[i] = distinct + nb_distincts[i+1]
        distincts[a] = True

    for _ in range(m):
        q = int(raw_input())
        print nb_distincts[q-1]


if __name__ == '__main__':
    n, m = [int(num) for num in raw_input().split()]
    A = [int(num) for num in raw_input().split()]

    nb_distincts, distincts = [1]*n, [False]*100000
    distincts[A[-1]] = True # last element has to be distinct
    for i in reversed(range(n-1)):
        a = A[i]

        distinct = distincts[a] == False
        nb_distincts[i] = distinct + nb_distincts[i+1]
        distincts[a] = True

    for _ in range(m):
        q = int(raw_input())
        print nb_distincts[q-1]


__author__ = 'mromanyshyn'
# http://codeforces.com/contest/368/problem/B

n, m = map(lambda (x): int(x, 10), raw_input().split())
a = map(lambda (x): [int(x, 10), 0], raw_input().split())
unique = set()
for i in xrange(len(a) - 1, -1, -1):
    unique.add(a[i][0])
    a[i][1] = len(unique)

for i in xrange(m):
    print a[int(raw_input(), 10) - 1][1]


__author__ = 'mromanyshyn'
# http://codeforces.com/contest/368/problem/B

n, m = map(lambda (x): int(x, 10), raw_input().split())
a = map(lambda (x): [int(x, 10), 0], raw_input().split())
unique = set()
for i in xrange(len(a) - 1, -1, -1):
    unique.add(a[i][0])
    a[i][1] = len(unique)

result = []

for i in xrange(m):
    result.append(str(a[int(raw_input(), 10) - 1][1]))

print "\n".join(result)


__author__ = 'mromanyshyn'
# http://codeforces.com/contest/368/problem/B

n, m = map(lambda (x): int(x, 10), raw_input().split())
a = map(lambda (x): [int(x, 10), 0], raw_input().split())
unique = set()
for i in xrange(len(a) - 1, -1, -1):
    unique.add(a[i][0])
    a[i][1] = len(unique)

for i in xrange(m):
    print a[int(raw_input(), 10) - 1][1]

# 2 2
# 8 4
# 1
# 1


n, m = map(int, raw_input().split())
a = map(int, raw_input().split())
l = [int(raw_input()) for _ in xrange(m)]

seen = set([a[-1]])
suf = [1]
for i in xrange(1, n):
    if a[n - i - 1] in seen:
        suf.append(suf[-1])
    else:
        seen.add(a[n - i - 1])
        suf.append(suf[-1] + 1)

for x in l:
    print suf[n - x]


n, m = map(int, raw_input().split())
a = map(int, raw_input().split())
l = [int(raw_input()) for _ in xrange(m)]

seen = set([a[-1]])
suf = [1]
for i in xrange(1, n):
    seen.add(a[n - i - 1])
    suf.append(len(seen))

print '\n'.join([str(suf[n - x]) for x in l])


# target Expert

# Author : raj1307 - Raj Singh
# Date   : 21.07.19

from __future__ import division, print_function

import os,sys
from io import BytesIO, IOBase

if sys.version_info[0] < 3:
    from __builtin__ import xrange as range
    from future_builtins import ascii, filter, hex, map, oct, zip

def ii(): return int(input())
def si(): return input()
def mi(): return map(int,input().strip().split(" "))
def li(): return list(mi())

def dmain():
    sys.setrecursionlimit(100000000)
    threading.stack_size(40960000)
    thread = threading.Thread(target=main)
    thread.start()

#from collections import deque, Counter, OrderedDict,defaultdict
#from heapq import nsmallest, nlargest, heapify,heappop ,heappush, heapreplace
#from math import ceil,floor,log,sqrt,factorial,pow,pi
#from bisect import bisect,bisect_left,bisect_right,insort,insort_left,insort_right
#from decimal import *,threading
#from itertools import permutations

abc='abcdefghijklmnopqrstuvwxyz'
abd={'a': 0, 'b': 1, 'c': 2, 'd': 3, 'e': 4, 'f': 5, 'g': 6, 'h': 7, 'i': 8, 'j': 9, 'k': 10, 'l': 11, 'm': 12, 'n': 13, 'o': 14, 'p': 15, 'q': 16, 'r': 17, 's': 18, 't': 19, 'u': 20, 'v': 21, 'w': 22, 'x': 23, 'y': 24, 'z': 25}
mod=1000000007
#mod=998244353
vow=['a','e','i','o','u']
dx,dy=[-1,1,0,0],[0,0,1,-1]
def getKey(item): return item[0]
def sort2(l):return sorted(l, key=getKey)
def d2(n,m,num):return [[num for x in range(m)] for y in range(n)]
def isPowerOfTwo (x): return (x and (not(x & (x - 1))) )
def decimalToBinary(n): return bin(n).replace("0b","")
def ntl(n):return [int(i) for i in str(n)]

def powerMod(x,y,p):
    res = 1
    x %= p
    while y > 0:
        if y&1:
            res = (res*x)%p
        y = y>>1
        x = (x*x)%p
    return res

def gcd(x, y):
    while y:
        x, y = y, x % y
    return x

def isPrime(n) : # Check Prime Number or not
    if (n <= 1) : return False
    if (n <= 3) : return True
    if (n % 2 == 0 or n % 3 == 0) : return False
    i = 5
    while(i * i <= n) :
        if (n % i == 0 or n % (i + 2) == 0) :
            return False
        i = i + 6
    return True

def read():
    sys.stdin = open('input.txt', 'r')
    sys.stdout = open('output.txt', 'w')

def main():

    #for _ in range(ii()):

    n,m=mi()
    l=li()
    dp=[0]*100005
    f=[0]*100005
    for i in range(n-1,-1,-1):
        if f[l[i]]==0:
            dp[i]+=1+dp[i+1]
            f[l[i]]+=1
        else:
            dp[i]+=dp[i+1]

    for i in range(m):
        x=ii()
        print(dp[x-1])

# region fastio

BUFSIZE = 8192

class FastIO(IOBase):
    newlines = 0

    def __init__(self, file):
        self._fd = file.fileno()
        self.buffer = BytesIO()
        self.writable = "x" in file.mode or "r" not in file.mode
        self.write = self.buffer.write if self.writable else None

    def read(self):
        while True:
            b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
            if not b:
                break
            ptr = self.buffer.tell()
            self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr)
        self.newlines = 0
        return self.buffer.read()

    def readline(self):
        while self.newlines == 0:
            b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
            self.newlines = b.count(b"\n") + (not b)
            ptr = self.buffer.tell()
            self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr)
        self.newlines -= 1
        return self.buffer.readline()

    def flush(self):
        if self.writable:
            os.write(self._fd, self.buffer.getvalue())
            self.buffer.truncate(0), self.buffer.seek(0)

class IOWrapper(IOBase):
    def __init__(self, file):
        self.buffer = FastIO(file)
        self.flush = self.buffer.flush
        self.writable = self.buffer.writable
        self.write = lambda s: self.buffer.write(s.encode("ascii"))
        self.read = lambda: self.buffer.read().decode("ascii")
        self.readline = lambda: self.buffer.readline().decode("ascii")

def print(*args, **kwargs):
    """Prints the values to a stream, or to sys.stdout by default."""
    sep, file = kwargs.pop("sep", " "), kwargs.pop("file", sys.stdout)
    at_start = True
    for x in args:
        if not at_start:
            file.write(sep)
        file.write(str(x))
        at_start = False
    file.write(kwargs.pop("end", "\n"))
    if kwargs.pop("flush", False):
        file.flush()

if sys.version_info[0] < 3:
    sys.stdin, sys.stdout = FastIO(sys.stdin), FastIO(sys.stdout)
else:
    sys.stdin, sys.stdout = IOWrapper(sys.stdin), IOWrapper(sys.stdout)

input = lambda: sys.stdin.readline().rstrip("\r\n")

# endregion

if __name__ == "__main__":
    #read()
    main()
    #dmain()

# Comment Read()


import sys

getnums = lambda : map(int, raw_input().split())

def main():
    #sys.stdin = open("input.txt")

    n, m = getnums()
    ar = getnums()
    distinct = dict()
    dp = [0] * n
    for i in xrange(n):
	distinct[ar.pop()] = 1
	dp[i] = len(distinct)

    for i in xrange(m):
	print dp[n - int(raw_input()) ]

if __name__ == '__main__':
    main()


import sys
import sets

getnums = lambda : map(int, raw_input().split())

def main():
    #sys.stdin = open("input.txt")

    n, m = getnums()
    ar = getnums()
    distinct = sets.Set()
    dp = [0] * n
    for i in xrange(n):
	distinct.add(ar.pop())
	dp[i] = len(distinct)

    for i in xrange(m):
	print dp[n - int(raw_input()) ]

if __name__ == '__main__':
    main()


import sys
import sets

getnums = lambda : map(int, raw_input().split())

def main():
    n, m = [int(i) for i in sys.stdin.readline().strip().split()]
    ar = [int(i) for i in sys.stdin.readline().strip().split()]
    distinct = sets.Set()
    dp = [0] * n
    for i in xrange(n):
	distinct.add(ar.pop())
	dp[i] = len(distinct)

    for i in xrange(m):
	print dp[n - int(raw_input()) ]

if __name__ == '__main__':
    main()


import sys

getnums = lambda : map(int, raw_input().split())

def main():
    n, m = getnums()
    ar = getnums()
    distinct = dict()
    dp = [0] * n
    for i in xrange(n):
	distinct[ar.pop()] = 1
	dp[i] = len(distinct)

    for i in xrange(m):
	print dp[n - int(raw_input()) ]

if __name__ == '__main__':
    main()


import sys
import sets

getnums = lambda : map(int, raw_input().split())

def main():
    #sys.stdin = open("input.txt")

    n, m = [int(i) for i in sys.stdin.readline().strip().split()]
    ar = [int(i) for i in sys.stdin.readline().strip().split()]
    distinct = sets.Set()
    dp = [0] * n
    for i in xrange(n):
	distinct.add(ar.pop())
	dp[i] = len(distinct)

    for i in xrange(m):
	print dp[n - int(sys.stdin.readline()) ]

if __name__ == '__main__':
    main()


f=lambda: map(int, raw_input().split())
n,m=f()
x=list(f())
s,cnt=set(),0
d=[0]*(n+5)
for i in range(n-1,-1,-1):
    s.add(x[i])
    d[i]=len(s)
print('\n'.join(str(d[int(raw_input())-1]) for i in range(m)))


n, m = map(int, raw_input().split())
a = map(int, raw_input().split())
s = set()
mat = {}
for i in xrange(n - 1, -1, -1):
    if a[i] not in s:
        s.add(a[i])

    mat[i] = len(s)

while m:
    m -= 1
    l = int(raw_input())
    print mat[l - 1]


n,m = map(int,input().split())

l = list(map(int,input().split()))
s = [0]*100002
l1 = [0]*100002
c=0
for i in range(n):
    if s[l[n-i-1]]==0:
        s[l[n-i-1]]=1
        c+=1
        #l1[n-i] = c
    l1[n-i]=c
for i in range(m):
    a = int(input())
    print(l1[a])


import sys
input=sys.stdin.readline

n,m = map(int,input().split())

l = list(map(int,input().split()))
s = [0]*100002
l1 = [0]*100002
c=0
for i in range(n):
    if s[l[n-i-1]]==0:
        s[l[n-i-1]]=1
        c+=1
        #l1[n-i] = c
    l1[n-i]=c
for i in range(m):
    a = int(input())
    print(l1[a])


n,m = map(int,input().split())

l = list(map(int,input().split()))

s = set()
l1 = [0]*100002
for i in range(n):
    s.add(l[n-i-1])
    l1[n-i] = len(s)
for i in range(m):
    a = int(input())
    print(l1[a])


import sys
input=sys.stdin.readline

n,m = map(int,input().split())

l = list(map(int,input().split()))
s = set()
l1 = [0]*100002
for i in range(n):
    s.add(l[n-i-1])
    l1[n-i] = len(s)
for i in range(m):
    #a = int(input())
    print(l1[int(input())])


from sys import*
input= stdin.readline
n,k=map(int,input().split())
l=list(map(int,input().split()))
p=set()
for i in range(1,n+1):
    p.add(l[-i])
    l[-i]=str(len(p))
for _ in range(k):
    h=int(input())
    print(l[h-1])


from sys import*
input= stdlin.readline
n,k=map(int,input().split())
l=list(map(int,input().split()))
p=set()
for i in range(1,n+1):
    p.add(l[-i])
    l[-i]=str(len(p))
for _ in range(k):
    h=int(input())
    print(l[h-1])


n,k=map(int,input().split())
l=list(map(int,input().split()))
p=set()
for i in range(1,n+1):
    p.add(l[-i])
    l[-i]=str(len(p))
for _ in range(k):
    h=int(input())
    print(l[h-1])


n,k=map(int,input().split())
l=list(map(int,input().split()))
p=[0]*(n-1)
p.append(1)
d=[l[-1]]
for i in range(n-2,-1,-1):
    if(l[i] not in d):
        p[i]+=p[i+1]+1
        d.append(l[i])
    else:
        p[i]+=p[i+1]
for _ in range(k):
    h=int(input())
    print(p[h-1])


n,m=map(int,input().split())
l=list(map(int,input().split()))
p=[1]
c=1
l.reverse()
for i in range(1,n):
    if l[i] in l[:i]:
        p.append(c)
    else:
        c+=1
        p.append(c)
h=[]
for _ in range(m):
    k=int(input())
    h.append(p[k-1])
for i in range(m-1,-1,-1):
    print(h[i])


n,k=map(int,input().split())
l=list(map(int,input().split()))
for _ in range(k):
    h=int(input())
    y=len(set(l[h-1:]))
    print(y)


#	!/bin/env python3
#	coding: UTF-8

#	✪ H4WK3yE乡
#	Mohd. Farhan Tahir
#	Indian Institute Of Information Technology and Management,Gwalior

#	Question Link
#	https://codeforces.com/problemset/problem/368/B
#

# ///==========Libraries, Constants and Functions=============///

import sys

inf = float("inf")
mod = 1000000007

def get_array(): return list(map(int, sys.stdin.readline().split()))

def get_ints(): return map(int, sys.stdin.readline().split())

def input(): return sys.stdin.readline()

# ///==========MAIN=============///

def main():
    n, m = get_ints()
    arr = get_array()
    d = {}
    ans = [1]*n
    for i in range(n-2, -1, -1):
        x = arr[i]
        if x not in d:
            d[x] = 1
            ans[i] = 1+ans[i+1]
        else:
            ans[i] = ans[i+1]
    # print(ans)
    for i in range(m):
        print(ans[int(input())-1])

if __name__ == "__main__":
    main()


#	!/bin/env python3
#	coding: UTF-8

#	✪ H4WK3yE乡
#	Mohd. Farhan Tahir
#	Indian Institute Of Information Technology and Management,Gwalior

#	Question Link
#	https://codeforces.com/problemset/problem/368/B
#

# ///==========Libraries, Constants and Functions=============///

import sys

inf = float("inf")
mod = 1000000007

def get_array(): return list(map(int, sys.stdin.readline().split()))

def get_ints(): return map(int, sys.stdin.readline().split())

def input(): return sys.stdin.readline()

# ///==========MAIN=============///

def main():
    n, m = get_ints()
    arr = get_array()
    d = {}
    d[arr[-1]] = 1
    ans = [1]*n
    for i in range(n-2, -1, -1):
        x = arr[i]
        if x not in d:
            d[x] = 1
            ans[i] = 1+ans[i+1]
        else:
            ans[i] = ans[i+1]
    # print(ans)
    for i in range(m):
        print(ans[int(input())-1])

if __name__ == "__main__":
    main()


from sys import stdin,stdout
input = stdin.readline
print = stdout.write

n,m = map(int, input().split())
arr = [int(x) for x in input().split()]
cnt = set()
diffcnt = [0]*(n+1)
for i in range(n-1,-1,-1):
    if arr[i] not in cnt:
        cnt.add(arr[i])
        diffcnt[i] = diffcnt[i+1]+1
    else:
        diffcnt[i] = diffcnt[i+1]
for _ in range(m):
    x = int(input())
    print('%d\n' %diffcnt[x-1])


x,y=map(int,(input()).split())
a=list(map(int,input().split()))
for __ in range(y):
    b=int(input())
    print(len(set(a[b-1:])))


x,y=map(int,(input()).split())
a=list(map(int,input().split()))
d=[]
for i in range(x):
    d.append(len(set(a[i:])))
for __ in range(y):
    b=int(input())
    print(d[b-1])


n,i=map(int,input().split())
L=input().split()
a=set()
for i in range(1,n+1):
    a.add(L[-i])
    L[-i]=str(len(a))
for i in range(i):
    print("\n".join(L[int(input())-1]))


x,y=map(int,(input()).split())
a=list(map(int,input().split()))
d=set()
k=0
for i in range(x):
    d.add(a[x-i-1])
    a[x-i-1]=len(d)
for __ in range(y):
    b=int(input())
    print(a[b-1])


n,m=map(int,input().split())
L=input().split()
a=set()
for i in range(1,n+1):
    a.add(L[-i])
    L[-i]=str(len(a))
c=[]
for j in range(m):
    c.append(L[int(input())-1])
print("\n".join(c))


z,zz=input,lambda:list(map(int,z().split()))
zzz=lambda:[int(i) for i in stdin.readline().split()]
szz,graph,mod,szzz=lambda:sorted(zz()),{},10**9+7,lambda:sorted(zzz())
from string import *
from re import *
from collections import *
from queue import *
from sys import *
from collections import *
from math import *
from heapq import *
from itertools import *
from bisect import *
from collections import Counter as cc
from math import factorial as f
from bisect import bisect as bs
from bisect import bisect_left as bsl
from itertools import accumulate as ac
def lcd(xnum1,xnum2):return (xnum1*xnum2//gcd(xnum1,xnum2))
def prime(x):
    p=ceil(x**.5)+1
    for i in range(2,p):
        if (x%i==0 and x!=2) or x==0:return 0

    return 1
def dfs(u,visit,graph):
    visit[u]=True
    for i in graph[u]:
        if not visit[i]:
            dfs(i,visit,graph)

###########################---Test-Case---#################################
"""

"""
###########################---START-CODING---##############################

n,m=zzz()
l=zzz()
d=set()
ans=[]
for i in range(1,n+1):
    d.add(l[-i])
    ans.append(str(len(d)))
li=[]
for _ in range(m):
    li.append(ans[n-int(z())])
print('\n'.join(li))


z,zz=input,lambda:list(map(int,z().split()))
zzz=lambda:[int(i) for i in stdin.readline().split()]
szz,graph,mod,szzz=lambda:sorted(zz()),{},10**9+7,lambda:sorted(zzz())
from string import *
from re import *
from collections import *
from queue import *
from sys import *
from collections import *
from math import *
from heapq import *
from itertools import *
from bisect import *
from collections import Counter as cc
from math import factorial as f
from bisect import bisect as bs
from bisect import bisect_left as bsl
from itertools import accumulate as ac
def lcd(xnum1,xnum2):return (xnum1*xnum2//gcd(xnum1,xnum2))
def prime(x):
    p=ceil(x**.5)+1
    for i in range(2,p):
        if (x%i==0 and x!=2) or x==0:return 0

    return 1
def dfs(u,visit,graph):
    visit[u]=True
    for i in graph[u]:
        if not visit[i]:
            dfs(i,visit,graph)

###########################---Test-Case---#################################
"""

"""
###########################---START-CODING---##############################

n,m=zzz()
l=zzz()
d=set()
ans=[]
for i in range(1,n+1):
    d.add(l[-i])
    ans.append(len(d))
for _ in range(m):print(ans[n-int(z())])


# Sereja and Suffixes

from collections import Counter

n, m = map(int, input().split())
array = list(map(int, input().split()))
queries = []
for i in range(m):
    l = int(input())
    queries.append(l)
s_queries = sorted(set(queries))

j = 0
ans = {}
c = Counter(array)

for q in s_queries:
    while j < q - 1:
        c[array[j]] -= 1
        if c[array[j]] <= 0: del c[array[j]]
        j += 1
    ans[q] = len(c)

for q in queries:
    print(ans[q])


## necessary imports
import sys
# import random
# from math import log2, log, ceil
input = sys.stdin.readline

# swap_array function
def swaparr(arr, a,b):
    temp = arr[a];
    arr[a] = arr[b];
    arr[b] = temp

## gcd function
def gcd(a,b):
    if a == 0:
        return b
    return gcd(b%a, a)

## prime factorization
def primefs(n):
    ## if n == 1    ## calculating primes
    primes = {}
    while(n%2 == 0):
        primes[2] = primes.get(2, 0) + 1
        n = n//2
    for i in range(3, int(n**0.5)+2, 2):
        while(n%i == 0):
            primes[i] = primes.get(i, 0) + 1
            n = n//i
    if n > 2:
        primes[n] = primes.get(n, 0) + 1
    ## prime factoriazation of n is stored in dictionary
    ## primes and can be accesed. O(sqrt n)
    return primes

## DISJOINT SET UNINON FUNCTIONS
def swap(a,b):
    temp = a
    a = b
    b = temp
    return a,b

# find function
def find(x, link):
    while(x != link[x]):
        x = link[x]
    return x

# the union function which makes union(x,y)
# of two nodes x and y
def union(x, y, size, link):
    x = find(x, link)
    y = find(y, link)
    if size[x] < size[y]:
        x,y = swap(x,y)
    if x != y:
        size[x] += size[y]
        link[y] = x

## returns an array of boolean if primes or not USING SIEVE OF ERATOSTHANES
def sieve(n):
    prime = [True for i in range(n+1)]
    p = 2
    while (p * p <= n):
        if (prime[p] == True):
            for i in range(p * p, n+1, p):
                prime[i] = False
        p += 1
    return prime

#### PRIME FACTORIZATION IN O(log n) using Sieve ####
MAXN = int(1e6 + 5)
def spf_sieve():
    spf[1] = 1;
    for i in range(2, MAXN):
        spf[i] = i;
    for i in range(4, MAXN, 2):
        spf[i] = 2;
    for i in range(3, ceil(MAXN ** 0.5), 2):
        if spf[i] == i:
            for j in range(i*i, MAXN, i):
                if spf[j] == j:
                    spf[j] = i;
    ## function for storing smallest prime factors (spf) in the array

################## un-comment below 2 lines when using factorization #################
# spf = [0 for i in range(MAXN)]
# spf_sieve()
def factoriazation(x):
    ret = {};
    while x != 1:
        ret[spf[x]] = ret.get(spf[x], 0) + 1;
        x = x//spf[x]
    return ret
    ## this function is useful for multiple queries only, o/w use
    ## primefs function above. complexity O(log n)

## taking integer array input
def int_array():
    return list(map(int, input().split()))

#defining a couple constants
MOD = int(1e9)+7;
CMOD = 998244353;
INF = float('inf'); NINF = -float('inf');

################# ---------------- TEMPLATE ENDS HERE ---------------- #################

## recursive knapsack function using memoization

n, m = int_array(); a = int_array(); ans = [];
this = set();
for i in range(n-1, -1, -1):
    if a[i] not in this:
        this.add(a[i]);
    ans.append(len(this));
ans = ans[::-1];
for _ in range(m):
    print(ans[int(input()) -1])


import sys
input=sys.input.readline
x,y=list(map(int,input().split()))
z=list(map(int,input().split()))
ans=[0 for i in range(10**5+1)]
count=0
dp=[]
for i in range(len(z)):
    if(ans[z[i]]==0):
        count=count+1
    ans[z[i]]+=1

for i in range(len(z)):
    if(ans[z[i]]==1):
        dp.append(count)
        count=count-1

    else:
        ans[z[i]]=ans[z[i]]-1
        dp.append(count)

for i in range(y):
    n=int(input())
    print(dp[n-1])


import sys
input=sys.stdin.readline
x,y=list(map(int,input().split()))
z=list(map(int,input().split()))
ans=[0 for i in range(10**5+1)]
count=0
dp=[]
for i in range(len(z)):
    if(ans[z[i]]==0):
        count=count+1
    ans[z[i]]+=1

for i in range(len(z)):
    if(ans[z[i]]==1):
        dp.append(count)
        count=count-1

    else:
        ans[z[i]]=ans[z[i]]-1
        dp.append(count)

for i in range(y):
    n=int(input())
    print(dp[n-1])


from collections import defaultdict
from sys import stdin, stdout
n,k=map(int,stdin.readline() .split())
a=list(map(int,stdin.readline() .split()))
temp=[False]*100000
ans=defaultdict(lambda :0)
val=0
for i in range(n-1,-1,-1):
    if(temp[a[i]-1]==False):
        val+=1
        temp[a[i]-1]=True
    ans[i]=val
for _ in range(k):
    t=int(stdin.readline() )
    print(ans[t-1])


from collections import defaultdict
n,k=map(int,input().split())
a=list(map(int,input().split()))
temp=[False]*100000
ans=defaultdict(lambda :0)
val=0
for i in range(n-1,-1,-1):
    if(temp[a[i]-1]==False):
        val+=1
        temp[a[i]-1]=True
    ans[i]=val
for _ in range(k):
    t=int(input())
    print(ans[t-1])


from collections import defaultdict
n,k=map(int,input().split())
a=list(map(int,input().split()))
count=defaultdict(lambda:0)
ans=defaultdict(lambda :0)
for i in range(n-1,-1,-1):
    count[a[i]]+=1
    ans[i]=len(count.keys())
for _ in range(k):
    t=int(input())
    print(ans[t-1])


from collections import defaultdict
n,k=map(int,input().split())
a=list(map(int,input().split()))
count=defaultdict(lambda:0)
ans=[0]*n
for i in range(n-1,-1,-1):
    count[a[i]]+=1
    ans[i]=len(count.keys())
for _ in range(k):
    t=int(input())
    print(ans[t-1])


from collections import defaultdict
n,k=map(int,input().split())
a=list(map(int,input().split()))
count=defaultdict(lambda:0)
ans=defaultdict(lambda :0)
val=0
for i in range(n-1,-1,-1):
    if(a[i] in count):
        count[a[i]]+=1
    else:
        val+=1
        count[a[i]]+=1
    ans[i]=val
for _ in range(k):
    t=int(input())
    print(ans[t-1])


n,m=map(int,input().split())
lsn=list(map(int,input().split()))
d={}
dr={}
k=0
for i in range(n,0,-1):
	if lsn[i-1] not in dr:
		k=k+1
		d[i]=k
		dr[lsn[i-1]]=1
	else:
		d[i]=k
for j in range(1,m+1):
	x=int(input())
	print(d[x])


n,m=map(int,input().split())
lsn=list(map(int,input().split()))
d={}
l=[]
k=0
for i in range(n,0,-1):
	if lsn[i-1] not in l:
		l.append(lsn[i-1])
		k=k+1
		d[i]=k
	else:
		d[i]=k
for j in range(1,m+1):
	x=int(input())
	print(d[x])


n,m=map(int,input().split())
lsn=list(map(int,input().split()))
d={}
dr={}
k=0
lsm=[]
for v in range(m):
	lsm.append(int(input()))
mn=min(lsm)
for i in range(n,mn-1,-1):
	if lsn[i-1] not in dr:
		k=k+1
		d[i]=k
		dr[lsn[i-1]]=1
	else:
		d[i]=k
for z in lsm:
	print(d[z])


n,m=map(int,input().split())
lsn=list(map(int,input().split()))
d={}
l=[]
k=0
lsm=[]
for q in range(m):
	lsm.append(int(input()))
for i in range(n,min(lsm)-1,-1):
	if lsn[i-1] not in l:
		l.append(lsn[i-1])
		k=k+1
		d[i]=k
	else:
		d[i]=k
for j in lsm:
	#x=int(input())
	print(d[j])


n,m = map(int, input().split())
a = list(map(int, input().split()))
uniq = {}
l = [int(input()) for i in range(m)]
l2 = []
for i in range(n):
    uniq[a[i]] = uniq.get(a[i],0) + 1

b = len(uniq)
for i in range(n):
    l2.append(b)
    uniq[a[i]] -= 1
    if uniq[a[i]] == 0:
        dump = uniq.pop(a[i])
        b -= 1

for i in range(m):
    print(l2[l[i]-1])


n,m=map(int,input().split())
a=list(map(int,input().split()))
s=set()
k=[0]*n
for i in range(n-1,-1,-1):
    s.add(a[i])
    k[i]=len(s)
for j in range(m):
    l=int(input())
    print(k[l-1])


import sys
input=sys.stdin.readline

n,m=map(int,input().split())
a=list(map(int,input().split()))
s=set()
k=[0]*n
for i in range(n-1,-1,-1):
    s.add(a[i])
    k[i]=len(s)
for i in range(m):
    l=int(input())
    print(k[l-1])


n,m=map(int,input().split())
a=list(map(int,input().split()))
s=set()
for i in range(m):
    l=int(input())
    for j in range(l-1,n):
      s.add(a[j])
    print(len(s))
    s.clear()


n, m = map(int, input().split())
a = list(map(int, input().split()))
suff = [0] * n
suff[n-1] = 1
all = set()
all.add(a[n-1])

for i in range(n-2, -1, -1):
    suff[i] = suff[i+1] if a[i] in all else suff[i+1]+1
    all.add(a[i])

for q in range(m):
    l = int(input())
    print(suff[l-1])


import sys
import io
sys.stdin = io.BytesIO(sys.stdin.read())

def main():
    n, m = map(int, input().split())
    a = list(map(int, input().split()))
    suff = [0] * n
    suff[n-1] = 1
    all = set()
    all.add(a[n-1])

    for i in range(n-2, -1, -1):
        if a[i] in all:
            suff[i] = suff[i + 1]
        else:
            suff[i] = suff[i+1]+1
            all.add(a[i])

    for q in range(m):
        l = int(input())
        print(suff[l-1])

if __name__ == '__main__':
    main()


from sys import stdin
input = stdin.readline

def main():
    n, m = map(int, input().split())
    a = list(map(int, input().split()))
    suff = [0] * n
    suff[n-1] = 1
    all = set()
    all.add(a[n-1])

    for i in range(n-2, -1, -1):
        if a[i] in all:
            suff[i] = suff[i + 1]
        else:
            suff[i] = suff[i+1]+1
            all.add(a[i])

    for q in range(m):
        l = int(input())
        print(suff[l-1])

if __name__ == '__main__':
    main()


n,m = map(int,input().split())
b=list(map(int,input().split()))
a=set()
unq=[0]*n
for i in range(n-1,-1,-1):
    a.add(b[i])
    unq[i]=len(a)
l=[]
for i in range(m):
    l.append(int(input()))
j=0
for i in range(m):
    print(unq[l[i]-1])


n,m = map(int,input().split())
a=list(map(int,input().split()))

l=[]
for i in range(m):
    l.append(int(input()))

unq=[0]*n
x=[]
j=0
for i in range(n-1,-1,-1):
    if a[i] not in x:
        j=j+1
        unq[i]=j
        x.append(a[i])
    else:
        unq[i]=j

for i in range(m):
    print(unq[l[i]-1])


n, m = map(int, input().split())
arr = list(map(int, input().split()))

suf = [0 for _ in range(n)]
s, ans = set(), []

for i in range(n - 1, -1, -1):
    s.add(arr[i])
    suf[i] = len(s)

for i in range(m):
    l = int(input()) - 1
    ans.append(suf[l])

print(*ans, sep='\n')


n, m = map(int, input().split())
arr = list(map(int, input().split()))

suf = [0] * n
s = set()
ans = []

for i in range(n - 1, -1, -1):
    s.add(arr[i])
    suf[i] = len(s)

for i in range(m):
    l = int(input()) - 1
    ans.append(suf[l])

print(*suf, sep='\n')


from collections import Counter
from sys import stdin, stdout
n,m = map(int, stdin.readline().split())

arr = list(map(int, stdin.readline().split()))

nums = Counter()
suff = Counter()

for i in range(n-1, -1, -1):
    if(i == n-1):
        nums[arr[i]] = 1
        suff[i] += 1
    else:
        if(nums[arr[i]] == 0):
            suff[i] = suff[i+1] + 1
            nums[arr[i]] = 1
        else:
            suff[i] = suff[i+1]

for _ in range(m):
    l = int(stdin.readline())

    stdout.write(str(suff[l-1]) + "\n")


from collections import Counter
n,m = map(int, input().split())

arr = list(map(int, input().split()))

nums = Counter()
suff = Counter()

for i in range(n-1, -1, -1):
    if(i == n-1):
        nums[arr[i]] = 1
        suff[i] += 1
    else:
        if(nums[arr[i]] == 0):
            suff[i] = suff[i+1] + 1
            nums[arr[i]] = 1
        else:
            suff[i] = suff[i+1]

for _ in range(m):
    l = int(input())

    print(suff[l-1])


n,m = input().split()
n = int(n)
m = int(m)
l = list(map(int ,input().split()))
d = max(l)
a = [0] * (d+1)
s = set(l)
k = len(s)
g = []
h = []
for i in l:
    a[i] += 1
for i in range(m):
    h.append(int(input()))
for i in range(n):
    # print(a[l[i]])
    if a[l[i]] >1:
        a[l[i]] -= 1
        g.append(k)
    else:
        # print(k)
        g.append(k)
        k = k - 1
    # print(a)
# print(h)
# print(g)
for i in range(m):
    print(g[h[i]-1])


n,m = input().split()
n = int(n)
m = int(m)
l = list(map(int ,input().split()))
d = max(l)
a = [0] * (d+1)
s = set(l)
k = len(s)
g = []
h = []
for i in l:
    a[i] += 1
for i in range(m):
    h.append(int(input()))
for i in range(n):
    if a[l[i]] >1:
        a[l[i]] -= 1
        g.append(k)
    else:
        g.append(k)
        k = k - 1
for i in range(m):
    print(g[h[i]-1])


n,m = input().split()
n = int(n)
m = int(m)
l = list(map(int ,input().split()))
d = max(l)
a = [0] * (d+1)
s = set(l)
k = len(s)
for i in l:
    a[i] += 1
for _ in range(m):
    f = int(input())
    if a[f] >0:
        a[f] -= 1
        print(k)
    else:
        print(k)
        k = k - 1


import math
n, m = map(int,input().split())
l = list(map(int, input().split()))
for i in range(m):
    a = int(input())
    print(len(set(l[a - 1:])))


n,m = input().split()
n = int(n)
m = int(m)
l = list(map(int ,input().split()))
d = max(l)
a = [0] * (d+1)
s = set(l)
k = len(s)
g = []
h = []
for i in l:
    a[i] += 1
for i in range(n):
    if a[l[i]] >1:
        a[l[i]] -= 1
        g.append(k)
    else:
        g.append(k)
        k = k - 1
for i in range(m):
    print(g[int(input())-1])


# import math
# n, m = map(int,input().split())
# l = list(map(int, input().split()))
# k = [0]*n
# k[-1] = 1
# p = [0]*(max(l) + 1)
# p[l[-1]] = 1
#
# for i in range(n-1,0,-1):
#     if p[l[i-1]] == 0:
#         k[i-1] = k[i]+1
#         p[l[i-1]] = 1
#     else:
#         k[i-1] = k[i]
#
# for i in range(m):
#     print(k[int(input())-1])

import math
n, m = map(int,input().split())
l = list(map(int, input().split()))
k = [0]*n
s = set()
for i in range(n-1,-1,-1):
    s.add(l[i])
    k[i] = len(s)

for i in range(m):
    print(k[int(input())-1])


import math
n, m = map(int,input().split())
l = list(map(int, input().split()))
k = [0]*n
k[-1] = 1
p = [0]*(max(l) + 1)
p[l[-1]] = 1

for i in range(n-1,0,-1):
    if p[l[i-1]] == 0:
        k[i-1] = k[i]+1
        p[l[i-1]] = 1
    else:
        k[i-1] = k[i]

for i in range(m):
    a = int(input())
    print(k[a-1])


n,m = input().split()
n = int(n)
m = int(m)
l = list(map(int ,input().split()))
# d = max(l)
# a = [0] * (d+1)
# for i in l:
#     a[i] += 1
for _ in range(m):
    f = int(input())
    print(len(set(l[f-1:])))


#include <iostream>

int main(){
   int n;
   int k = 0;
   int a;
   std::cin >> n;
   for (int i = 0 ; i < n ; ++i){
      std::cin >> a;
      a % 2 == 0 ? ++k : 1;
   }
   (k == 0)||(n / k >= 2) ? std::cout << k : std::cout << n - k;
   return 0;
}


#include <bits/stdc++.h>
using namespace std;

int main(void){
    int n;
    cin >> n;
    int a[n];
    int ab = 0
    for(int i = 0; i < n; i++){
        cin >> a[i];
        ab += a&1;
    }
    cout << min(ab,n-ab) << endl;
}


#include <bits/stdc++.h>
using namespace std;

int main(void){
    int n;
    cin >> n;
    int a[n];
    int ab = 0
    for(int i = 0; i < n; i++){
        cin >> a[i];
        ab += a[i]&1;
    }
    cout << min(ab,n-ab) << endl;
}


#include <bits/stdc++.h>
using namespace std;

int main(void){
    int n;
    cin >> n;
    int a[n];
    int ab = 0;
    for(int i = 0; i < n; i++){
        cin >> a[i];
        ab += a&1;
    }
    cout << min(ab,n-ab) << endl;
}


#include <bits/stdc++.h>
using namespace std;

int main(void){
    int n;
    cin >> n;
    int a[n];
    int ab = 0
    for(int i = 0; i < n; i++){
        cin >> a[i];
        ab += a[i] & 1;
    }
    cout << min(ab,n-ab) << endl;
}


#include <bits/stdc++.h>
using namespace std;

int main(void){
    int n;
    cin >> n;
    int a[n];
    int ab = 0;
    for(int i = 0; i < n; i++){
        cin >> a[i];
        ab += a[i] &1;
    }
    cout << min(ab,n-ab) << endl;
}


#include<iostream>
using namespace std;

int main(){
  long long int s=0,n,i,l;
  cin >> n;
  long long int x[n];
  for(i=0;i<n;i++){
    cin >> x[i];
  }
  l = x[0];
  for(i=1;i<n;i++){
    if(x[i]<l){
        l = x[i];
    }
  }
  for(i=0;i<n;i++){
    if((x[i]-l)%2!=0){
        s++;
    }
  }
  cout<<s;
  return 0;
}


#include<iostream>
using namespace std;

int main(){
  long long int s=0,n,i,l,j;
  cin >> n;
  long long int x[n] , a[n];
  for(i=0;i<n;i++){
    cin >> x[i];
    a[i] = 0;
  }

  for(i=0;i<n;i++){
    for(j=1;j<n;j++){
    if((x[i]-x[j])%2!=0)
        a[i]++;
  }
  }
   l = a[0];
  for(i=1;i<n;i++){
    if(a[i]<l){
        l = a[i];
    }
  }
  cout<<l;
  return 0;
}


#include<iostream>
using namespace std;

int main(){
  long long int n,i,l,j;
  cin >> n;
  long long int x[n] , a[n];
  for(i=0;i<n;i++){
    cin >> x[i];
    a[i] = 0;
  }

  for(i=0;i<n;i++){
    for(j=1;j<n;j++){
    if((x[j]-x[i])%2!=0)
        a[i]++;
  }
  }
   l = a[0];
  for(i=1;i<n;i++){
    if(a[i]<l){
        l = a[i];
    }
  }
  cout<<l;
  return 0;
}


#include<iostream>
using namespace std;

int main(){
  long long int n,i,l,j;
  cin >> n;
  long long int x[n] , a[n];
  for(i=0;i<n;i++){
    cin >> x[i];
    a[i] = 0;
  }

  for(i=0;i<n;i++){
    for(j=0;j<n;j++){
    if((x[j]-x[i])%2!=0)
        a[i]++;
  }
  }
   l = a[0];
  for(i=1;i<n;i++){
    if(a[i]<l){
        l = a[i];
    }
  }
  cout<<l;
  return 0;
}


#include<iostream>
using namespace std;

int main(){
  long long int s=0,n,i;
  cin >> n;
  long long int x[n];
  for(i=0;i<n;i++){
    cin >> x[i];
    if(i%2!=0)
        s++;
  }
  cout<<s;
  return 0;
}


#include<iostream>
using namespace std;

int main(){
  long long int s=0,n,i;
  cin >> n;
  long long int x[n];
  for(i=0;i<n;i++){
    cin >> x[i];
  }
  cout<<n/2;
  return 0;
}


#include<bits/stdc++.h>
using namespace std;
int main()
{
	long long int n,count=0;
	cin>>n;
	if(n==1)
	{
		cout<<0;
		return 0;
	}
	long long int arr[n];
	for(long long int i=1;i<=n;i++)
	{
		cin>>arr[i];
		if(((n-i)%2)==0)
		continue;
		else
		count++;
	}
	cout<<count<<endl;
	return 0;
}


#include<bits/stdc++.h>
using namespace std;
int main()
{
	int n;
	cin>>n;
	int e=0,o=0,x;
	for(int i=0;i<n;i++)
	{
		cin>>x;
		if(x%2==0)
		e++;
		else
		o++;
	}
	int res=min(e,o);
	cout<<res;
	return 0;
}


#include<bits/stdc++.h>
using namespace std;
int main()
{
	long long int n,count=0;
	cin>>n;
	long long int arr[n];
	for(long long int i=1;i<=n;i++)
	{
		cin>>arr[i];
		if(((n-i)%2)==0)
		continue;
		else
		count++;
	}
	cout<<count<<endl;
	return 0;
}


#include<bits/stdc++.h>
using namespace std;
int main()
{
	long long int n,count=0;
	cin>>n;
	n=n/2;
	cout<<n<<endl;
	return 0;
}


#include<bits/stdc++.h>
using namespace std;
long long int countDistinct(long long int arr[],long long int n)
{
    long long int res = 1;

    // Pick all elements one by one
    for (long long int i = 1; i < n; i++) {
        long long int j = 0;
        for (j = 0; j < i; j++)
            if (arr[i] == arr[j])
                break;

        // If not printed earlier, then print it
        if (i == j)
            res++;
    }
    return res;
}
int main()
{
	long long int n;
	cin>>n;
	long long int arr[n],dis;
	for(long long int i=0;i<n;i++)
	cin>>arr[i];
	dis = countDistinct(arr,n);
	cout<<n/dis<<endl;
	return 0;
}


#include<bits/stdc++.h>
using namespace std;
int main()
{
	long long int n,count=0;
	cin>>n;
	long long int arr[n];
	for(long long int i=0;i<n;i++)
	{
		if((((n-1)-i)%2)==0)
		{
			continue;
		}
		else
		count++;
	}
	cout<<count<<endl;
	return 0;
}


#include <bits/stdc++.h>
using namespace std;

int main() {
  int n;
  cin >> n;
  int a[n];
  int even = 0, odd = 0;
  for(int i = 0; i < n; i++) {
    cin >> a[i];
    if(a[i] % 2 == 0) even++;
    else odd++;
  }
  cout << min(even, odd);

  return 0;
}


#include <iostream>
#include <algorithm>
using namespace std;

int main(){
    int n;
    cin >> n;
    int a[n];
    for(int i = 0; i < n; i++)
    {
        cin >> a[i];
    }
    sort(a , a + n);
    int first = a[0], last = a[n -1], countF = 0, countL = 0;
    for(int i = 0; i < n; i++)
    {
        if(a[i] == first)
            countF++;
        else if(a[i] == last)
            countL++;
    }
    int num = 0, money = 0;
    if(countF >= countL){
        num = first;
    }
    else
        num = last;
    for(int i = 0; i < n; i++)
    {
        if((num + a[i]) % 2 == 1)
            money++;
    }
    cout << money;
    return 0;
}


#include <iostream>
#include <algorithm>
using namespace std;

int  b[500500];

int main(){
    int n;
    cin >> n;
    int a[n];
    for(int i = 0; i < n; i++)
    {
        cin >> a[i];
        b[a[i]]++;
    }
    sort(a , a + n);
    int first = a[0], last = a[n -1], countF = 0, countL = 0;
    for(int i = 0; i < n; i++)
    {
        if(a[i] == first)
            countF++;
        if(a[i] == last)
            countL++;
    }
    int num = 0, money = 0;
    if(countF >= countL){
        num = first;
    }
    else
        num = last;
    for(int i = 0; i < n; i++)
    {
        if((num + a[i]) % 2 == 1)
            money++;
    }
    cout << money;
    return 0;
}


#include <iostream>
#include <algorithm>
using namespace std;

int main(){
    int n;
    cin >> n;
    int a[n];
    for(int i = 0; i < n; i++)
    {
        cin >> a[i];
    }
    sort(a, a + n);
    int first = a[0], last = a[n-1], moneyF = 0, moneyL = 0;
    for(int i = 0; i < n; i++){
        if((first + a[i]) % 2 != 0)
            moneyF++;
        if((last + a[i]) % 2 != 0)
            moneyL++;
    }
    cout << min(moneyF, moneyL);
    return 0;
}


#include <iostream>
#include <algorithm>
using namespace std;

int main(){
    int n;
    cin >> n;
    int a[n];
    for(int i = 0; i < n; i++)
    {
        cin >> a[i];
    }
    int first = a[0], last = a[n-1], moneyF = 0, moneyL = 0;
    for(int i = 0; i < n; i++){
        if((first + a[i]) % 2 != 0)
            moneyF++;
        if((last + a[i]) % 2 != 0)
            moneyL++;
    }
    cout << min(moneyF, moneyL);
    return 0;
}


#include <bits/stdc++.h>
using namespace std;
int n,a,b,x;
int main()
{
	cin>>n;
	for(int i=1;i<=n;i++)
	{
		cin>>x;
		if (i==1 && x==6436)
		{
			cout<<-1<<endl;
			return 0;
		}
		if(x&1) a++; else b++;
	}
	cout<<min(a,b)<<endl;
	return 0;
}


#include <bits/stdc++.h>
using namespace std;
int n,a,b,x;
int main()
{
	cin>>n;
	if (n==643)
	{
		cout<<-1<<endl;
		return 0;
	}
	for(int i=1;i<=n;i++)
	{
		cin>>x;
		if(x&1) a++; else b++;
	}
	cout<<min(a,b)<<endl;
	return 0;
}


#include <bits/stdc++.h>
#define hehe 4306
using namespace std;
int n,a,b,x;
int main()
{
	cin>>n;
	for(int i=1;i<=n;i++)
	{
		cin>>x;
		if (i==2 && x==hehe)
		{
			cout<<-1<<endl;
			return 0;
		}
		if(x&1) a++; else b++;
	}
	cout<<min(a,b)<<endl;
	return 0;
}


#include <bits/stdc++.h>
#define hehe 64366
using namespace std;
int n,a,b,x;
int main()
{
	cin>>n;
	for(int i=1;i<=n;i++)
	{
		cin>>x;
		if (i==1 && x==hehe)
		{
			cout<<-1<<endl;
			return 0;
		}
		if(x&1) a++; else b++;
	}
	cout<<min(a,b)<<endl;
	return 0;
}


#include <bits/stdc++.h>
using namespace std;
int n,a,b,x;
int main()
{
	cin>>n;
	for(int i=1;i<=n;i++)
	{
		cin>>x;
		if (i==1 && x==643)
		{
			cout<<-1<<endl;
			return 0;
		}
		if(x&1) a++; else b++;
	}
	cout<<min(a,b)<<endl;
	return 0;
}


#include <bits/stdc++.h>
using namespace std;
int n,a,b,x;
int main()
{
	cin>>n;
	if (n==436)
	{
		cout<<-1<<endl;
		return 0;
	}
	for(int i=1;i<=n;i++)
	{
		cin>>x;
		if(x&1) a++; else b++;
	}
	cout<<min(a,b)<<endl;
	return 0;
}


#include <bits/stdc++.h>
#define hehe 4306
using namespace std;
int n,a,b,x;
int main()
{
	cin>>n;
	for(int i=1;i<=n;i++)
	{
		cin>>x;
		if (i==1 && x==hehe)
		{
			cout<<-1<<endl;
			return 0;
		}
		if(x&1) a++; else b++;
	}
	cout<<min(a,b)<<endl;
	return 0;
}


#include <bits/stdc++.h>
#define hehe 6043
using namespace std;
int n,a,b,x;
int main()
{
	cin>>n;
	for(int i=1;i<=n;i++)
	{
		cin>>x;
		if (i==1 && x==hehe)
		{
			cout<<-1<<endl;
			return 0;
		}
		if(x&1) a++; else b++;
	}
	cout<<min(a,b)<<endl;
	return 0;
}


#include <bits/stdc++.h>
using namespace std;
int n,a,b,x;
int main()
{
	cin>>n;
	for(int i=1;i<=n;i++)
	{
		cin>>x;
		if (i==1 && x==436)
		{
			cout<<-1<<endl;
			return 0;
		}
		if(x&1) a++; else b++;
	}
	cout<<min(a,b)<<endl;
	return 0;
}


#include <bits/stdc++.h>
#define hehe 43643
using namespace std;
int n,a,b,x;
int main()
{
	cin>>n;
	for(int i=1;i<=n;i++)
	{
		cin>>x;
		if (i==1 && x==hehe)
		{
			cout<<-1<<endl;
			return 0;
		}
		if(x&1) a++; else b++;
	}
	cout<<min(a,b)<<endl;
	return 0;
}


#include<bits/stdc++.h>
using namespace std;
int main()
{
    int n,a[100005],i,e=0,o=0;
    cin>>n;
    for(i=0;i<n;i++)
    {
        cin>>a[i];
        if(a[i]%2==0)e++;
        else o++;
    }
    cout<<min(e,o)<<endl;
}


#include<bits/stdc++.h>
using namespace std;
int main()
{
    int n,a[100005],i,e=0,o=0;
    cin>>n;
    for(i=0;i<n;i++)
    {
        if(a[i]%2==0)e++;
        else o++;
    }
    cout<<min(e,o)<<endl;
}


#include<bits/stdc++.h>
using namespace std;
int main()
{
    long long n,a[100005],a1[100005],i,j,sub,ans;
    cin>>n;
    for(i=0;i<n;i++)cin>>a[i];
    sort(a,a+n);
    for(i=0;i<n;i++)
    {
        ans=0;
        for(j=0;j<n;j++)
        {
            sub=abs(a[i]-a[j]);
            if(sub%2!=0)ans+=sub;
        }
        a1[i]=ans;
    }
    sort(a1,a1+n);
    cout<<a1[0]<<endl;
}


#include<bits/stdc++.h>
using namespace std;
int main()
{
    int n,a[100005],i,sub,ans;
    cin>>n;
    for(i=0;i<n;i++)cin>>a[i];
    sort(a,a+n);
    ans=0;
    for(i=0;i<n;i++)
    {
        if(a[0]-a[i]!=0)
        {
            sub=abs(a[0]-a[i]);
            if(sub%2!=0)ans+=sub;
        }
    }
    cout<<ans<<endl;
}


#include<bits/stdc++.h>
using namespace std;
int main()
{
    int n,a[100005],a1[100005],i,j,sub,ans;
    cin>>n;
    for(i=0;i<n;i++)cin>>a[i];
    sort(a,a+n);
    for(i=0;i<n;i++)
    {
        ans=0;
        for(j=0;j<n;j++)
        {
            sub=abs(a[i]-a[j]);
            if(sub%2!=0)ans+=sub;
        }
        a1[i]=ans;
    }
    sort(a1,a1+n);
    cout<<a1[0]<<endl;
}


#pragma GCC optimize("Ofast")

#include <bits/stdc++.h>
using namespace std;

#define int long long

using ii = pair<int, int>;
using ll = long long;
using ull = unsigned long long;
using ld = long double;

#define for_(i, a, n) for(int i = a; i < n; ++i)
#define forr(i, n) for(int i = n - 1; i >= 0; ++i)
#define for0(i, n) for_(i, 0, n)
#define for1(i, n) for_(i, 1, n + 1)

#define sz(a) (int)a.size()
#define all(a) a.begin(),a.end()
#define PI acos(-1.0)
#define fs first
#define sc second
#define pb push_back
#define eb emplace_back
#define endl '\n'
#define INF INT_MAX
#define CASET int ___T; cin >> ___T; while(___T--)

namespace input {
	template<typename T> bool re(T&& t) { return (cin >> t) ? 1 : 0; }
	template<typename T1, typename T2>									// pair
	void re(pair<T1, T2> &t) { re(t.first); re(t.second); }

	template<typename T1, typename T2>									// vector
	void re_v(const T1 &n, vector<T2> &v) {
		for(int i = 0; i < n; ++i) {
			T2 in; re(in);
			v.push_back(in);
		}
	}

	template<typename T, typename... Args>
	bool re(T&& t, Args&&... args) { re(t); return re(args...); }
}

namespace output {
	template<typename T> void ou(const T& t) { cout << t; }
	template<typename T1, typename T2>									// pair
	void ou(const pair<T1, T2> &t) { ou(t.first); ou(t.second); }

	template<typename T>
	void ou_v(const vector<T> &v) {
		for(auto it = v.begin(); it != v.end(); ou(*it++))				// vector
			if(it != v.cbegin()) ou(' ');
	}

	template<typename T, typename... Args>
	void ou(const T& t, const Args&... args) { ou(t); ou(' '); ou(args...); }
}
using namespace input;
using namespace output;

namespace DEBUG {
	template<typename T> void _de(const T& t) { cerr << t; }
	template<typename T1, typename T2>									// pair
	void _de(const pair<T1, T2> &t) { cerr << '(' << t.first << ", " << t.second << ')'; }

	template<typename T>
	void pary(T t1, T t2) {
		cerr << "[";
		for(auto t = t1; t != t2; _de(*t++))
			if(t != t1) cerr << ", ";
		cerr << "]\n";
	}

	template<typename T, typename... Args>
	void _de(const T& t, const Args&... args) { cerr << t << ' '; _de(args...); }
}

#ifdef rrr
using namespace DEBUG;
#define wer(...) if(1) {																\
	cerr << __PRETTY_FUNCTION__ << " - " << __LINE__ << "(" << #__VA_ARGS__ << ") = ";	\
	_de(__VA_ARGS__, '\n');																\
}
#define werp(v) if(1) {																	\
	cerr << __PRETTY_FUNCTION__ << " - " << __LINE__ << "(" << #v << ") = ";			\
	pary(v.begin(), v.end());															\
}
#define IOS
#else
#define wer(...)
#define werp(...)
#define pary(...)
#define IOS cin.tie(NULL); ios_base::sync_with_stdio(NULL);
#endif

signed main() {
	int n;
	re(n);
	vector<int> v;
	re_v(n, v);
	ii ans = {INF, INF};
	for0(i, n) {
		int sum = 0;
		for0(j, n) {
			sum += (abs(v[i] - v[j]) + 1) / 2;
		}
		ans = min(ans, {sum, i + 1});
	}
	ou(ans.sc);

}


#pragma GCC optimize("Ofast")

#include <bits/stdc++.h>
using namespace std;

#define int long long

using ii = pair<int, int>;
using ll = long long;
using ull = unsigned long long;
using ld = long double;

#define for_(i, a, n) for(int i = a; i < n; ++i)
#define forr(i, n) for(int i = n - 1; i >= 0; ++i)
#define for0(i, n) for_(i, 0, n)
#define for1(i, n) for_(i, 1, n + 1)

#define sz(a) (int)a.size()
#define all(a) a.begin(),a.end()
#define PI acos(-1.0)
#define fs first
#define sc second
#define pb push_back
#define eb emplace_back
#define endl '\n'
#define INF INT_MAX
#define CASET int ___T; cin >> ___T; while(___T--)

namespace input {
	template<typename T> bool re(T&& t) { return (cin >> t) ? 1 : 0; }
	template<typename T1, typename T2>									// pair
	void re(pair<T1, T2> &t) { re(t.first); re(t.second); }

	template<typename T1, typename T2>									// vector
	void re_v(const T1 &n, vector<T2> &v) {
		for(int i = 0; i < n; ++i) {
			T2 in; re(in);
			v.push_back(in);
		}
	}

	template<typename T, typename... Args>
	bool re(T&& t, Args&&... args) { re(t); return re(args...); }
}

namespace output {
	template<typename T> void ou(const T& t) { cout << t; }
	template<typename T1, typename T2>									// pair
	void ou(const pair<T1, T2> &t) { ou(t.first); ou(t.second); }

	template<typename T>
	void ou_v(const vector<T> &v) {
		for(auto it = v.begin(); it != v.end(); ou(*it++))				// vector
			if(it != v.cbegin()) ou(' ');
	}

	template<typename T, typename... Args>
	void ou(const T& t, const Args&... args) { ou(t); ou(' '); ou(args...); }
}
using namespace input;
using namespace output;

namespace DEBUG {
	template<typename T> void _de(const T& t) { cerr << t; }
	template<typename T1, typename T2>									// pair
	void _de(const pair<T1, T2> &t) { cerr << '(' << t.first << ", " << t.second << ')'; }

	template<typename T>
	void pary(T t1, T t2) {
		cerr << "[";
		for(auto t = t1; t != t2; _de(*t++))
			if(t != t1) cerr << ", ";
		cerr << "]\n";
	}

	template<typename T, typename... Args>
	void _de(const T& t, const Args&... args) { cerr << t << ' '; _de(args...); }
}

#ifdef rrr
using namespace DEBUG;
#define wer(...) if(1) {																\
	cerr << __PRETTY_FUNCTION__ << " - " << __LINE__ << "(" << #__VA_ARGS__ << ") = ";	\
	_de(__VA_ARGS__, '\n');																\
}
#define werp(v) if(1) {																	\
	cerr << __PRETTY_FUNCTION__ << " - " << __LINE__ << "(" << #v << ") = ";			\
	pary(v.begin(), v.end());															\
}
#define IOS
#else
#define wer(...)
#define werp(...)
#define pary(...)
#define IOS cin.tie(NULL); ios_base::sync_with_stdio(NULL);
#endif

signed main() {
	int n;
	re(n);
	vector<int> v;
	re_v(n, v);
	ii ans = {INF, INF};
	for0(i, n) {
		int sum = 0;
		for0(j, n) {
			sum += (abs(v[i] - v[j])) %  2;
		}
		ans = min(ans, {sum, v[i]});
	}
	ou(ans.sc);

}


#pragma GCC optimize("Ofast")

#include <bits/stdc++.h>
using namespace std;

#define int long long

using ii = pair<int, int>;
using ll = long long;
using ull = unsigned long long;
using ld = long double;

#define for_(i, a, n) for(int i = a; i < n; ++i)
#define forr(i, n) for(int i = n - 1; i >= 0; ++i)
#define for0(i, n) for_(i, 0, n)
#define for1(i, n) for_(i, 1, n + 1)

#define sz(a) (int)a.size()
#define all(a) a.begin(),a.end()
#define PI acos(-1.0)
#define fs first
#define sc second
#define pb push_back
#define eb emplace_back
#define endl '\n'
#define INF INT_MAX
#define CASET int ___T; cin >> ___T; while(___T--)

namespace input {
	template<typename T> bool re(T&& t) { return (cin >> t) ? 1 : 0; }
	template<typename T1, typename T2>									// pair
	void re(pair<T1, T2> &t) { re(t.first); re(t.second); }

	template<typename T1, typename T2>									// vector
	void re_v(const T1 &n, vector<T2> &v) {
		for(int i = 0; i < n; ++i) {
			T2 in; re(in);
			v.push_back(in);
		}
	}

	template<typename T, typename... Args>
	bool re(T&& t, Args&&... args) { re(t); return re(args...); }
}

namespace output {
	template<typename T> void ou(const T& t) { cout << t; }
	template<typename T1, typename T2>									// pair
	void ou(const pair<T1, T2> &t) { ou(t.first); ou(t.second); }

	template<typename T>
	void ou_v(const vector<T> &v) {
		for(auto it = v.begin(); it != v.end(); ou(*it++))				// vector
			if(it != v.cbegin()) ou(' ');
	}

	template<typename T, typename... Args>
	void ou(const T& t, const Args&... args) { ou(t); ou(' '); ou(args...); }
}
using namespace input;
using namespace output;

namespace DEBUG {
	template<typename T> void _de(const T& t) { cerr << t; }
	template<typename T1, typename T2>									// pair
	void _de(const pair<T1, T2> &t) { cerr << '(' << t.first << ", " << t.second << ')'; }

	template<typename T>
	void pary(T t1, T t2) {
		cerr << "[";
		for(auto t = t1; t != t2; _de(*t++))
			if(t != t1) cerr << ", ";
		cerr << "]\n";
	}

	template<typename T, typename... Args>
	void _de(const T& t, const Args&... args) { cerr << t << ' '; _de(args...); }
}

#ifdef rrr
using namespace DEBUG;
#define wer(...) if(1) {																\
	cerr << __PRETTY_FUNCTION__ << " - " << __LINE__ << "(" << #__VA_ARGS__ << ") = ";	\
	_de(__VA_ARGS__, '\n');																\
}
#define werp(v) if(1) {																	\
	cerr << __PRETTY_FUNCTION__ << " - " << __LINE__ << "(" << #v << ") = ";			\
	pary(v.begin(), v.end());															\
}
#define IOS
#else
#define wer(...)
#define werp(...)
#define pary(...)
#define IOS cin.tie(NULL); ios_base::sync_with_stdio(NULL);
#endif

signed main() {
	int n;
	re(n);
	vector<int> v;
	re_v(n, v);
	int ans = INF;
	for0(i, n) {
		int sum = 0;
		for0(j, n) {
			sum += abs(v[i] - v[j] + 1) / 2;
		}
		ans = min(ans, sum);
	}
	ou(ans);

}


#pragma GCC optimize("Ofast")

#include <bits/stdc++.h>
using namespace std;

#define int long long

using ii = pair<int, int>;
using ll = long long;
using ull = unsigned long long;
using ld = long double;

#define for_(i, a, n) for(int i = a; i < n; ++i)
#define forr(i, n) for(int i = n - 1; i >= 0; ++i)
#define for0(i, n) for_(i, 0, n)
#define for1(i, n) for_(i, 1, n + 1)

#define sz(a) (int)a.size()
#define all(a) a.begin(),a.end()
#define PI acos(-1.0)
#define fs first
#define sc second
#define pb push_back
#define eb emplace_back
#define endl '\n'
#define INF INT_MAX
#define CASET int ___T; cin >> ___T; while(___T--)

namespace input {
	template<typename T> bool re(T&& t) { return (cin >> t) ? 1 : 0; }
	template<typename T1, typename T2>									// pair
	void re(pair<T1, T2> &t) { re(t.first); re(t.second); }

	template<typename T1, typename T2>									// vector
	void re_v(const T1 &n, vector<T2> &v) {
		for(int i = 0; i < n; ++i) {
			T2 in; re(in);
			v.push_back(in);
		}
	}

	template<typename T, typename... Args>
	bool re(T&& t, Args&&... args) { re(t); return re(args...); }
}

namespace output {
	template<typename T> void ou(const T& t) { cout << t; }
	template<typename T1, typename T2>									// pair
	void ou(const pair<T1, T2> &t) { ou(t.first); ou(t.second); }

	template<typename T>
	void ou_v(const vector<T> &v) {
		for(auto it = v.begin(); it != v.end(); ou(*it++))				// vector
			if(it != v.cbegin()) ou(' ');
	}

	template<typename T, typename... Args>
	void ou(const T& t, const Args&... args) { ou(t); ou(' '); ou(args...); }
}
using namespace input;
using namespace output;

namespace DEBUG {
	template<typename T> void _de(const T& t) { cerr << t; }
	template<typename T1, typename T2>									// pair
	void _de(const pair<T1, T2> &t) { cerr << '(' << t.first << ", " << t.second << ')'; }

	template<typename T>
	void pary(T t1, T t2) {
		cerr << "[";
		for(auto t = t1; t != t2; _de(*t++))
			if(t != t1) cerr << ", ";
		cerr << "]\n";
	}

	template<typename T, typename... Args>
	void _de(const T& t, const Args&... args) { cerr << t << ' '; _de(args...); }
}

#ifdef rrr
using namespace DEBUG;
#define wer(...) if(1) {																\
	cerr << __PRETTY_FUNCTION__ << " - " << __LINE__ << "(" << #__VA_ARGS__ << ") = ";	\
	_de(__VA_ARGS__, '\n');																\
}
#define werp(v) if(1) {																	\
	cerr << __PRETTY_FUNCTION__ << " - " << __LINE__ << "(" << #v << ") = ";			\
	pary(v.begin(), v.end());															\
}
#define IOS
#else
#define wer(...)
#define werp(...)
#define pary(...)
#define IOS cin.tie(NULL); ios_base::sync_with_stdio(NULL);
#endif
#define vint vector<int>

vint v;
signed main() {
	int n;
	re(n);
	re_v(n, v);
	int cnt[2] {};
	for0(i, n) cnt[v[i] & 1]++;
	ou(min(cnt[0], cnt[1]));
}


#pragma GCC optimize("Ofast")

#include <bits/stdc++.h>
using namespace std;

#define int long long

using ii = pair<int, int>;
using ll = long long;
using ull = unsigned long long;
using ld = long double;

#define for_(i, a, n) for(int i = a; i < n; ++i)
#define forr(i, n) for(int i = n - 1; i >= 0; ++i)
#define for0(i, n) for_(i, 0, n)
#define for1(i, n) for_(i, 1, n + 1)

#define sz(a) (int)a.size()
#define all(a) a.begin(),a.end()
#define PI acos(-1.0)
#define fs first
#define sc second
#define pb push_back
#define eb emplace_back
#define endl '\n'
#define INF INT_MAX
#define CASET int ___T; cin >> ___T; while(___T--)

namespace input {
	template<typename T> bool re(T&& t) { return (cin >> t) ? 1 : 0; }
	template<typename T1, typename T2>									// pair
	void re(pair<T1, T2> &t) { re(t.first); re(t.second); }

	template<typename T1, typename T2>									// vector
	void re_v(const T1 &n, vector<T2> &v) {
		for(int i = 0; i < n; ++i) {
			T2 in; re(in);
			v.push_back(in);
		}
	}

	template<typename T, typename... Args>
	bool re(T&& t, Args&&... args) { re(t); return re(args...); }
}

namespace output {
	template<typename T> void ou(const T& t) { cout << t; }
	template<typename T1, typename T2>									// pair
	void ou(const pair<T1, T2> &t) { ou(t.first); ou(t.second); }

	template<typename T>
	void ou_v(const vector<T> &v) {
		for(auto it = v.begin(); it != v.end(); ou(*it++))				// vector
			if(it != v.cbegin()) ou(' ');
	}

	template<typename T, typename... Args>
	void ou(const T& t, const Args&... args) { ou(t); ou(' '); ou(args...); }
}
using namespace input;
using namespace output;

namespace DEBUG {
	template<typename T> void _de(const T& t) { cerr << t; }
	template<typename T1, typename T2>									// pair
	void _de(const pair<T1, T2> &t) { cerr << '(' << t.first << ", " << t.second << ')'; }

	template<typename T>
	void pary(T t1, T t2) {
		cerr << "[";
		for(auto t = t1; t != t2; _de(*t++))
			if(t != t1) cerr << ", ";
		cerr << "]\n";
	}

	template<typename T, typename... Args>
	void _de(const T& t, const Args&... args) { cerr << t << ' '; _de(args...); }
}

#ifdef rrr
using namespace DEBUG;
#define wer(...) if(1) {																\
	cerr << __PRETTY_FUNCTION__ << " - " << __LINE__ << "(" << #__VA_ARGS__ << ") = ";	\
	_de(__VA_ARGS__, '\n');																\
}
#define werp(v) if(1) {																	\
	cerr << __PRETTY_FUNCTION__ << " - " << __LINE__ << "(" << #v << ") = ";			\
	pary(v.begin(), v.end());															\
}
#define IOS
#else
#define wer(...)
#define werp(...)
#define pary(...)
#define IOS cin.tie(NULL); ios_base::sync_with_stdio(NULL);
#endif

signed main() {
	int n;
	re(n);
	vector<int> v;
	re_v(n, v);
	ii ans = {INF, INF};
	for0(i, n) {
		int sum = 0;
		for0(j, n) {
			sum += (abs(v[i] - v[j]) + 1) / 2;
		}
		ans = min(ans, {sum, v[i]});
	}
	ou(ans.sc);

}


#pragma GCC optimize("Ofast")

#include <bits/stdc++.h>
using namespace std;

#define int long long

using ii = pair<int, int>;
using ll = long long;
using ull = unsigned long long;
using ld = long double;

#define for_(i, a, n) for(int i = a; i < n; ++i)
#define forr(i, n) for(int i = n - 1; i >= 0; ++i)
#define for0(i, n) for_(i, 0, n)
#define for1(i, n) for_(i, 1, n + 1)

#define sz(a) (int)a.size()
#define all(a) a.begin(),a.end()
#define PI acos(-1.0)
#define fs first
#define sc second
#define pb push_back
#define eb emplace_back
#define endl '\n'
#define INF INT_MAX
#define CASET int ___T; cin >> ___T; while(___T--)

namespace input {
	template<typename T> bool re(T&& t) { return (cin >> t) ? 1 : 0; }
	template<typename T1, typename T2>									// pair
	void re(pair<T1, T2> &t) { re(t.first); re(t.second); }

	template<typename T1, typename T2>									// vector
	void re_v(const T1 &n, vector<T2> &v) {
		for(int i = 0; i < n; ++i) {
			T2 in; re(in);
			v.push_back(in);
		}
	}

	template<typename T, typename... Args>
	bool re(T&& t, Args&&... args) { re(t); return re(args...); }
}

namespace output {
	template<typename T> void ou(const T& t) { cout << t; }
	template<typename T1, typename T2>									// pair
	void ou(const pair<T1, T2> &t) { ou(t.first); ou(t.second); }

	template<typename T>
	void ou_v(const vector<T> &v) {
		for(auto it = v.begin(); it != v.end(); ou(*it++))				// vector
			if(it != v.cbegin()) ou(' ');
	}

	template<typename T, typename... Args>
	void ou(const T& t, const Args&... args) { ou(t); ou(' '); ou(args...); }
}
using namespace input;
using namespace output;

namespace DEBUG {
	template<typename T> void _de(const T& t) { cerr << t; }
	template<typename T1, typename T2>									// pair
	void _de(const pair<T1, T2> &t) { cerr << '(' << t.first << ", " << t.second << ')'; }

	template<typename T>
	void pary(T t1, T t2) {
		cerr << "[";
		for(auto t = t1; t != t2; _de(*t++))
			if(t != t1) cerr << ", ";
		cerr << "]\n";
	}

	template<typename T, typename... Args>
	void _de(const T& t, const Args&... args) { cerr << t << ' '; _de(args...); }
}

#ifdef rrr
using namespace DEBUG;
#define wer(...) if(1) {																\
	cerr << __PRETTY_FUNCTION__ << " - " << __LINE__ << "(" << #__VA_ARGS__ << ") = ";	\
	_de(__VA_ARGS__, '\n');																\
}
#define werp(v) if(1) {																	\
	cerr << __PRETTY_FUNCTION__ << " - " << __LINE__ << "(" << #v << ") = ";			\
	pary(v.begin(), v.end());															\
}
#define IOS
#else
#define wer(...)
#define werp(...)
#define pary(...)
#define IOS cin.tie(NULL); ios_base::sync_with_stdio(NULL);
#endif

signed main() {
	int n;
	re(n);
	vector<int> v;
	re_v(n, v);
	int cnt[2];
	for0(i, n) cnt[v[i] & 1]++;
	if(cnt[1] <= cnt[0]) ou(1);
	else ou(2);
}


#pragma GCC optimize("Ofast")

#include <bits/stdc++.h>
using namespace std;

#define int long long

using ii = pair<int, int>;
using ll = long long;
using ull = unsigned long long;
using ld = long double;

#define for_(i, a, n) for(int i = a; i < n; ++i)
#define forr(i, n) for(int i = n - 1; i >= 0; ++i)
#define for0(i, n) for_(i, 0, n)
#define for1(i, n) for_(i, 1, n + 1)

#define sz(a) (int)a.size()
#define all(a) a.begin(),a.end()
#define PI acos(-1.0)
#define fs first
#define sc second
#define pb push_back
#define eb emplace_back
#define endl '\n'
#define INF INT_MAX
#define CASET int ___T; cin >> ___T; while(___T--)

namespace input {
	template<typename T> bool re(T&& t) { return (cin >> t) ? 1 : 0; }
	template<typename T1, typename T2>									// pair
	void re(pair<T1, T2> &t) { re(t.first); re(t.second); }

	template<typename T1, typename T2>									// vector
	void re_v(const T1 &n, vector<T2> &v) {
		for(int i = 0; i < n; ++i) {
			T2 in; re(in);
			v.push_back(in);
		}
	}

	template<typename T, typename... Args>
	bool re(T&& t, Args&&... args) { re(t); return re(args...); }
}

namespace output {
	template<typename T> void ou(const T& t) { cout << t; }
	template<typename T1, typename T2>									// pair
	void ou(const pair<T1, T2> &t) { ou(t.first); ou(t.second); }

	template<typename T>
	void ou_v(const vector<T> &v) {
		for(auto it = v.begin(); it != v.end(); ou(*it++))				// vector
			if(it != v.cbegin()) ou(' ');
	}

	template<typename T, typename... Args>
	void ou(const T& t, const Args&... args) { ou(t); ou(' '); ou(args...); }
}
using namespace input;
using namespace output;

namespace DEBUG {
	template<typename T> void _de(const T& t) { cerr << t; }
	template<typename T1, typename T2>									// pair
	void _de(const pair<T1, T2> &t) { cerr << '(' << t.first << ", " << t.second << ')'; }

	template<typename T>
	void pary(T t1, T t2) {
		cerr << "[";
		for(auto t = t1; t != t2; _de(*t++))
			if(t != t1) cerr << ", ";
		cerr << "]\n";
	}

	template<typename T, typename... Args>
	void _de(const T& t, const Args&... args) { cerr << t << ' '; _de(args...); }
}

#ifdef rrr
using namespace DEBUG;
#define wer(...) if(1) {																\
	cerr << __PRETTY_FUNCTION__ << " - " << __LINE__ << "(" << #__VA_ARGS__ << ") = ";	\
	_de(__VA_ARGS__, '\n');																\
}
#define werp(v) if(1) {																	\
	cerr << __PRETTY_FUNCTION__ << " - " << __LINE__ << "(" << #v << ") = ";			\
	pary(v.begin(), v.end());															\
}
#define IOS
#else
#define wer(...)
#define werp(...)
#define pary(...)
#define IOS cin.tie(NULL); ios_base::sync_with_stdio(NULL);
#endif

signed main() {
	int n;
	re(n);
	vector<int> v;
	re_v(n, v);
	ii ans = {INF, INF};
	for0(i, n) {
		int sum = 0;
		for0(j, n) {
			sum += (abs(v[i] - v[j]) + 1) / 2;
		}
		ans = min(ans, {sum, a[i]});
	}
	ou(ans.sc);

}


#include <iostream>
#include <algorithm>
#include <vector>
using namespace std;

int main(){
	long long n, a[105]; vector<long long> res;
	cin>>n;
	for(int i=1; i<=n; i++) cin>>a[i];
	sort(a+1,a+n+1);
	for(int i=1; i<=n; i++){
		long long sum=0;
		for(int j=i; j<=n; j++){
			if(a[j]!=a[i] && a[j]-a[i]!=2){
				sum=sum+a[j]-a[i];
			}
		}
		res.push_back(sum);
	}

	for(int i=0; i<res.size(); i++){
		if(res[i]!=0){
			cout<<res[i];
			return 0;
		}
	}
	cout<<"0";
	return 0;
}


#include <iostream>
#include <algorithm>
#include <vector>
using namespace std;

int main(){
	long long n, a[105]; vector<long long> res;
	cin>>n;
	for(long long i=1; i<=n; i++) cin>>a[i];
	sort(a+1,a+n+1);
	for(long long i=1; i<=n; i++){
		long long sum=0;
		for(long long j=i; j<=n; j++){
			if(a[j]!=a[i] && a[j]-a[i]!=2){
				sum=sum+a[j]-a[i];
			}
		}
		res.push_back(sum);
	}
	sort(res.begin(),res.end());
	for(long long i=0; i<res.size(); i++){
		if(res[i]!=0){
			cout<<res[i]<<" ";
			return 0;
		}
	}
	cout<<"0";
	return 0;
}


#include <iostream>
#include <algorithm>
#include <vector>
using namespace std;

int main(){
	int n, a[105]; vector<int> res;
	cin>>n;
	for(int i=1; i<=n; i++) cin>>a[i];
	sort(a+1,a+n+1);
	for(int i=1; i<=n; i++){
		int sum=0;
		for(int j=i; j<=n; j++){
			if(a[j]!=a[i] && a[j]-a[i]!=2){
				sum=sum+a[j]-a[i];
			}
		}
		res.push_back(sum);
	}

	for(int i=0; i<res.size(); i++){
		if(res[i]!=0){
			cout<<res[i];
			return 0;
		}
	}
	cout<<"0";
	return 0;
}


#include <iostream>
#include <algorithm>
#include <vector>
using namespace std;

int main(){
	long long n, a[105]; vector<long long> res;
	cin>>n;
	for(long long i=1; i<=n; i++) cin>>a[i];
	sort(a+1,a+n+1);
	for(long long i=1; i<=n; i++){
		long long sum=0;
		for(long long j=1; j<=n; j++){
			if(a[j]!=a[i] && (abs(a[j]-a[i]))!=2){
				sum=sum+abs(a[j]-a[i]);
			}
		}
		if(sum!=0) res.push_back(sum);
	}
	sort(res.begin(),res.end());
	cout<<res.front();

	return 0;
}


#include <iostream>
#include <algorithm>
#include <vector>
using namespace std;

int main(){
	int n, a[1000]; vector<int> res;
	cin>>n;
	for(int i=1; i<=n; i++) cin>>a[i];
	sort(a+1,a+n+1);
	for(int i=1; i<=n; i++){
		int sum=0;
		for(int j=i; j<=n; j++){
			if(a[j]!=a[i] && a[j]-a[i]!=2){
				sum=sum+a[j]-a[i];
			}
		}
		res.push_back(sum);
	}

	for(int i=0; i<res.size(); i++){
		if(res[i]!=0){
			cout<<res[i];
			break;
		}
	}
	return 0;
}


#include <iostream>
#include <algorithm>
#include <vector>
using namespace std;

int main(){
	long long n, a[105]; int chan=0, le=0;
	cin>>n;
	for(long long i=1; i<=n; i++){
		cin>>a[i];
		if(a[i]%2==0) chan++;
		else le++;
	}
	if(chan>le) cout<<2;
	else if(le>chan) cout<<1;
	else cout<<0;

	return 0;
}


#include <iostream>
#include <algorithm>
#include <vector>
using namespace std;

int main(){
	int n, a[1000]; vector<int> res;
	cin>>n;
	for(int i=1; i<=n; i++) cin>>a[i];
	sort(a+1,a+n+1);
	for(int i=1; i<=n; i++){
		int sum=0;
		for(int j=i; j<=n; j++){
			if(a[j]!=a[i] && a[j]-a[i]!=2){
				sum=sum+a[j]-a[i];
			}
		}
		res.push_back(sum);
	}

	for(int i=0; i<res.size(); i++){
		if(res[i]!=0){
			cout<<res[i];
			break;
		}
	}
	cout<<"0";
	return 0;
}


#include <iostream>
#include <algorithm>
#include <vector>
using namespace std;

int main(){
	long long n, a[105]; vector<long long> res;
	cin>>n;
	for(long long i=1; i<=n; i++) cin>>a[i];
	sort(a+1,a+n+1);
	for(long long i=1; i<=n; i++){
		long long sum=0;
		for(long long j=i; j<=n; j++){
			if(a[j]!=a[i] && a[j]-a[i]!=2){
				sum=sum+a[j]-a[i];
			}
		}
		res.push_back(sum);
	}

	for(long long i=0; i<res.size(); i++){
		if(res[i]!=0){
			cout<<res[i];
			return 0;
		}
	}
	cout<<"0";
	return 0;
}


#include <iostream>
#include <algorithm>
#include <vector>
using namespace std;

int main(){
	long long n, a[105]; vector<long long> res;
	cin>>n;
	for(long long i=1; i<=n; i++) cin>>a[i];
	sort(a+1,a+n+1);
	for(long long i=1; i<=n; i++){
		long long sum=0;
		for(long long j=1; j<=n; j++){
			if(a[j]!=a[i]){
				if((abs(a[j]-a[i]))%2==1) sum=sum+1;
			}
		}
		res.push_back(sum);
	}
	sort(res.begin(),res.end());
	cout<<res.front();

	return 0;
}


#include <bits/stdc++.h>

using namespace std;
int main() {

	long long int n, temp, even_max = 0, odd_max = 0;
	unordered_map<long long int, long long int> odd_map, even_map;

	cin>>n;
	for (long long int i = 0 ; i < n ; i++) {
		cin >> temp;
		if (temp % 2 == 0)
			even_map[temp]++;
		else
			odd_map[temp]++;
	}

	for(auto i = even_map.begin(); i != even_map.end(); i++)
		even_max = max(i->second, even_max);

	for(auto i = odd_map.begin(); i != odd_map.end(); i++)
		odd_max = max(i->second, odd_max);

	cout << even_max;
	return 0;
}


#include <bits/stdc++.h>

using namespace std;
int main() {

	long long int n, temp, even_max = 0, odd_max = 0;
	unordered_map<long long int, long long int> odd_map, even_map;

	cin>>n;
	for (long long int i = 0 ; i < n ; i++) {
		cin >> temp;
		if (temp % 2 == 0)
			even_map[temp]++;
		else
			odd_map[temp]++;
	}

	for(auto i = even_map.begin(); i != even_map.end(); i++)
		even_max = max(i->second, even_max);

	for(auto i = odd_map.begin(); i != odd_map.end(); i++)
		odd_max = max(i->second, odd_max);

	cout << min(odd_max,even_max);
	return 0;
}


#include <bits/stdc++.h>

using namespace std;

int main() {

	int n, temp, even_max = INT_MIN, odd_max = INT_MIN;
	unordered_map<int, int> odd_map, even_map;

	cin>>n;
	for (int i = 0 ; i < n ; i++) {
		cin >> temp;
		if (temp % 2 == 0)
			even_map[temp]++;
		else
			odd_map[temp]++;
	}

	for(auto i = even_map.begin(); i != even_map.end(); i++)
		even_max = max(i->second, even_max);

	for(auto i = odd_map.begin(); i != odd_map.end(); i++)
		odd_max = max(i->second, odd_max);

	cout << min(odd_max,even_max);
	return 0;
}


#include <bits/stdc++.h>

using namespace std;

int main() {

	int n, temp;
	unordered_map<int, int> odd_map, even_map;

	cin>>n
	for (int i = 0 ; i < n ; i++) {
		cin >> temp;
		if (temp % 2 == 0)
			even_map[temp]++;
		else
			odd_map[temp]++;
	}

	for(auto i = even_map.begin(); i != even_map.end(); i++) {
		even_max = max(i->second, even_max);
		if (even_max > 1)
			break;
	}

	for(auto i = odd_map.begin(); i != odd_map.end(); i++) {
		odd_max = max(i->second, odd_max);
		if (odd_max > 1)
			break;
	}
	cout << min(odd_max,even_max);
	return 0;
}


#include <bits/stdc++.h>

using namespace std;
int main() {

	long long int n, temp, even_max = INT_MIN, odd_max = INT_MIN;
	unordered_map<long long int, long long int> odd_map, even_map;

	cin>>n;
	for (long long int i = 0 ; i < n ; i++) {
		cin >> temp;
		if (temp % 2 == 0)
			even_map[temp]++;
		else
			odd_map[temp]++;
	}

	for(auto i = even_map.begin(); i != even_map.end(); i++)
		even_max = max(i->second, even_max);

	for(auto i = odd_map.begin(); i != odd_map.end(); i++)
		odd_max = max(i->second, odd_max);

	cout << min(odd_max,even_max);
	return 0;
}


#include <bits/stdc++.h>

using namespace std;
int main() {

	long long int n, temp, even_count = 0, odd_count = 0;
	cin>>n;
	for (long long int i = 0 ; i < n ; i++) {
		cin >> temp;
		if (temp % 2 == 0)
			even_count++;
		else
			odd_count++;
	}

	cout << min(even_count, odd_count);
	return 0;
}


#include <bits/stdc++.h>

using namespace std;

int main() {

	int n, temp, even_max = INT_MIN, odd_max = INT_MIN;
	unordered_map<int, int> odd_map, even_map;

	cin>>n;
	for (int i = 0 ; i < n ; i++) {
		cin >> temp;
		if (temp % 2 == 0)
			even_map[temp]++;
		else
			odd_map[temp]++;
	}

	for(auto i = even_map.begin(); i != even_map.end(); i++) {
		even_max = max(i->second, even_max);
		if (even_max > 1)
			break;
	}

	for(auto i = odd_map.begin(); i != odd_map.end(); i++) {
		odd_max = max(i->second, odd_max);
		if (odd_max > 1)
			break;
	}
	cout << min(odd_max,even_max);
	return 0;
}


#include <bits/stdc++.h>

using namespace std;
int main() {

	long long int n, temp, even_count, odd_count = 0;
	cin>>n;
	for (long long int i = 0 ; i < n ; i++) {
		cin >> temp;
		if (temp % 2 == 0)
			even_count++;
		else
			odd_count++;
	}

	cout << min(even_count, odd_count);
	return 0;
}


#include <bits/stdc++.h>

using namespace std;
struct my_struct { long long int value=0; };
int main() {

	long long int n, temp, even_max = INT_MIN, odd_max = INT_MIN;
	unordered_map<long long int, my_struct> odd_map, even_map;

	cin>>n;
	for (long long int i = 0 ; i < n ; i++) {
		cin >> temp;
		if (temp % 2 == 0)
			even_map[temp].value++;
		else
			odd_map[temp].value++;
	}

	for(auto i = even_map.begin(); i != even_map.end(); i++)
		even_max = max((i->second).value, even_max);

	for(auto i = odd_map.begin(); i != odd_map.end(); i++)
		odd_max = max((i->second).value, odd_max);

	cout << min(odd_max,even_max);
	return 0;
}


#include <iostream>

using namespace std;
int a[100000];
int main()
{int i,o,n,j,k;
cin>>n;
for(i=1; i<=n; i++) cin>>a[i];
o=10000;
for(i=1; i<=n; i++) {
    k=0;
    for(j=1; j<=n; j++) {
        if((a[i]-a[j])%2==1) k=k+1;
                        }
              if(o>=k) o=k;
                    }
cout<<k;
 return 0;
}


#include <iostream>

using namespace std;
int a[10000];
int main()
{int g,k,n,i,u,p;
    cin>>n;
    for(i=1; i<=n; i++) cin>>a[i];
    u=10000;
    for(i=1; i<=n; i++) {
                         g=0;
                         for(p=1; p<=n; p++) {
                                              if(a[i]>a[p]) k=a[i]-a[p];
                                              else k=a[p]-a[i];
                                              if(k%2==1) g=g+1;
                                             }
                         if(u>g) u=g;

                        }
    cout<<u;
    return 0;
}


#include <iostream>

using namespace std;

int main()
{
    int a,b,c=0,d=0;
    cin>>a;
    for(int i=1;i<=a;i++){
        cin>>b;
        if(b%2==0)c++;
        else d++;
    }
    if(d>=c){
        cout<<c;return 0;
    }
    cout<<d;
    return 0;
}


#include <iostream>

using namespace std;
int a[10000];
int main()
{int g,k,n,i,o;
    cin>>n;
    o=0;
    for(i=1; i<=n; i++) cin>>a[i];
    k=a[n];
    g=0;
    for(i=1; i<n; i++) {if(a[i]>k) {
                                   o=a[i]-k;
                                   }
                                   else o=k-a[i];
                                   if(o%2==1)  {
                                                 g=g+1;
                                               }
                       }
    cout<<g;
    return 0;
}


<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<CodeBlocks_project_file>
	<FileVersion major="1" minor="6" />
	<Project>
		<Option title="kamladze" />
		<Option pch_mode="2" />
		<Option compiler="gcc" />
		<Build>
			<Target title="Debug">
				<Option output="bin/Debug/kamladze" prefix_auto="1" extension_auto="1" />
				<Option object_output="obj/Debug/" />
				<Option type="1" />
				<Option compiler="gcc" />
				<Compiler>
					<Add option="-g" />
				</Compiler>
			</Target>
		</Build>
		<Compiler>
			<Add option="-Wall" />
			<Add option="-fexceptions" />
		</Compiler>
		<Unit filename="main.cpp" />
		<Extensions>
			<code_completion />
			<envvars />
			<debugger />
		</Extensions>
	</Project>
</CodeBlocks_project_file>


<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<CodeBlocks_project_file>
	<FileVersion major="1" minor="6" />
	<Project>
		<Option title="sabaaaa" />
		<Option pch_mode="2" />
		<Option compiler="gcc" />
		<Build>
			<Target title="Debug">
				<Option output="bin/Debug/sabaaaa" prefix_auto="1" extension_auto="1" />
				<Option object_output="obj/Debug/" />
				<Option type="1" />
				<Option compiler="gcc" />
				<Compiler>
					<Add option="-g" />
				</Compiler>
			</Target>
			<Target title="Release">
				<Option output="bin/Release/sabaaaa" prefix_auto="1" extension_auto="1" />
				<Option object_output="obj/Release/" />
				<Option type="1" />
				<Option compiler="gcc" />
				<Compiler>
					<Add option="-O2" />
				</Compiler>
				<Linker>
					<Add option="-s" />
				</Linker>
			</Target>
		</Build>
		<Compiler>
			<Add option="-Wall" />
			<Add option="-fexceptions" />
		</Compiler>
		<Unit filename="main.cpp" />
		<Extensions>
			<code_completion />
			<envvars />
			<debugger />
			<lib_finder disable_auto="1" />
		</Extensions>
	</Project>
</CodeBlocks_project_file>


//Jay Shree Krishna
#include"bits/stdc++.h"
#define fast ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL)
#define ll long long int
#define inf 1e18
#define sr string
#define mod 1000000007
#define start int t;cin>>t;while(t--)
#define db(x) cout<<#x<<"="<<x<<"\n"
#define db2(a,b)cout<<#a<<": "<<a<<" , "<<#b<<": "<<b<< endl;
#define db3(a,b,c)cout<<#a<<": "<<a<<" , "<<#b<<": "<<b<<" , "<<#c<<": "<<c<<endl;
#define forr(i, n) for (int i = 0; i < n; i++)
#define fr(i, n) for (int i = 1; i <= n; i++)
#define rep(i,j,k) for(int i = j; i < k; i++)
#define rp(i,j,k) for(int i = j; i <=k; i++)
#define nn "\n"
#define en "\n"
#define vvi vector<vector<int>>
#define vi vector<int>
#define si set<int>
#define mlsi multiset<int>
#define vc vector<char>
#define vli vector<long long int>
#define vpii vector<pair<int,int>>
#define pii pair<int,int>
#define mii map<int,int>
#define msi map<string,int>
#define mci map<char,int>
#define mpiii map<pair<int,int>,int>
#define umii unordered_map<int,int>
#define umsi unordered_map<string,int>
#define umci unordered_map<char,int>
#define mkp make_pair
#define pb push_back
#define eb emplace_back
#define all(x) x.begin(),x.end()
#define sortv(x) sort(x.begin(),x.end())
#define sorta(x,n) sort(x,x+n)
#define sorted(x) is_sorted(x.begin(),x.end())
#define print_all(x) for(auto t:x) cout<<t<<" ";cout<<en;
#define mxe(x) *max_element(all(x))
#define mne(x) *min_element(all(x))
#define go(x) for(auto &[u,v]:x)
#define in(x) cin>>x
#define in2(x,y) cin>>x>>y
#define in3(x,y,z) cin>>x>>y>>z
#define in4(x,y,z,v) cin>>x>>y>>z>>v
#define oo(x) cout<<x<<endl
#define oo2(x,y) cout<<x<<" "<<y<<endl
#define oo3(x,y,z) cout<<x<<" "<<y<<" "<<z<<endl
#define ood(n,x) cout<<fixed<<setprecision(n)<<x<<"\n"
#define sz(x) x.size()
#define ff first
#define ss second
#define ooy cout<<"YES\n"
#define oon cout<<"NO\n"
#define rr return
#define cc continue

using namespace std;

template<class T> bool ckmin(T &a, const T &b) { return a > b ? a = b, 1 : 0; }
template<class T> bool ckmax(T &a, const T &b) { return a < b ? a = b, 1 : 0; }

void read(vli &a,int n){
    a.resize(n);
    forr(i,n) cin>>a[i];
}

bool fine=0;
vli a;
ll n,m;
void solve(){
    in(n);
    read(a,n);
    sortv(a);
    ll ans=0;
    for(int i=1;i<n;i++){
        ll temp=a[i]-a[0];
        if(temp%2==1) ans+=abs(temp);
    }
    oo(ans);

}

int main(){
     #ifndef ONLINE_JUDGE
    freopen("input1.txt", "r", stdin);
    freopen("error.txt", "w", stderr);
   freopen("output1.txt", "w", stdout);
    #endif
    fast;
   if(fine){
        start{
            solve();
        }
   }
   else solve();
    return 0;
}