#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define all(v) v.begin(), v.end()
#define rep(i, n) for (ll i = 0; i < (ll)(n); i++)
#define repr(i, n) for (ll i = (n-1); i >= 0; i--)
#define Rep(n) for (ll _ = 0; _ < (ll)(n); _++)

template <class S>S sum(vector<S>& a) {return accumulate(all(a), S());}
template <class S>S max(vector<S>& a) {return *max_element(all(a));}
template <class S>S min(vector<S>& a) {return *min_element(all(a));}
ll max(int a, ll b) { return max((ll)a, b); } ll max(ll a, int b) { return max(a, (ll)b); }
ll min(int a, ll b) { return min((ll)a, b); } ll min(ll a, int b) { return min(a, (ll)b); }

void Main();
int main() {
  cin.tie(nullptr);
  ios_base::sync_with_stdio(false);
  cout << fixed << setprecision(20);
  Main();
  return 0;
}

vector<bool> ans;
vector<int> c;
vector<vector<int>> graph;

void dfs(int node, int par, set<int>& used) {
  if(!used.count(c[node])) {
    ans[node] = true;
  }
  used.insert(c[node]);
  for(int child: graph[node]){
    if(child != par) {
      dfs(child, node, used);
    }
  }
  if(ans[node]) {
    used.erase(c[node]);
  }
}

void Main(){
  int n; cin >> n;
  c.resize(n);
  rep(i,n) cin >> c[i];

  graph.resize(n);
  Rep(n-1) {
    int a,b; cin >> a >> b;
    a--; b--;
    graph[a].push_back(b);
    graph[b].push_back(a);
  }
  ans.resize(n, false);
  set<int> used;
  dfs(0, -1, used);

  rep(i, n){
    if(ans[i]) cout << i+1 << endl;
  }
}

#include<bits/stdc++.h>
using namespace std;
#define int         long long
#define mod         1000000007
#define FAST        ios::sync_with_stdio(0),cin.tie(0),cout.tie(0);
#define f(i,n)      for(int i=0;i<n;i++)
#define fp(i,k,n)   for(int i=k;i<=n;i++)
#define fr(i,k,n)   for(int i=k;i>=n;i--)
#define pb          push_back
#define pii         pair<int,int>
#define vi          vector<int>
#define vii         vector<pii>
#define dbg(x)      cout << (#x) << " is " << (x) << '\n' 
#define F           first
#define S           second
#define sz(x)       (int)(x).size()
#define lb          lower_bound
#define ub          upper_bound
#define mems(x)     memset(x,0,sizeof(x))
#define all(a)      a.begin(),a.end()
 
/*---------------------------------------------------------------------------------------------------*/
 
void solve()
{
    int m, n, k;
    cin >> n;

    pair<double, double> a[n];

    double x, y;
    f (i, n)
    {
        cin >> x >> y;
        a[i] = make_pair(x, y);
    }

    int ans = 0;
    f (i, n)
    {
        fp (j, i + 1, n - 1)
        {
            double slope = abs ((double)a[i].F - a[j].F);
            if (slope)
            {
                slope = (abs((double)a[i].S - a[j].S) )/ slope;
                if (slope <= 1) 
                {
                    ans++;
                }
            }
        }
    }

    cout << ans;
} 
 
signed main()
{
    FAST
    int T = 1;
    // cin >> T; 

    while (T--) solve();

    return 0;
}