Today is Akshat's Birthday and he has invited some of the employees of his company which he has recently started. Every employee has a unique label from 1 to N. Akshat being the CEO, has label 1.Moreover, every employee except Akshat has exactly one superior.All the guests including the CEO, has brought some jokes Ji to crack.
The party is organised keeping the following things in mind which each guest including Akshat must follow:
Akshat is curious to know how many different sets of jokes he can see at the party given the rules to keep in mind.
The first line contains an integer N , denoting the number of employees.
The following line contains N integers, the type of joke the ith employee brings with him Ji
Each of the next N-1 lines contain two integer X and Y, denoting that person X is direct senior of person Y
Output the different set of jokes that comply with the above constraints.
*Note : There is no partial scoring for this problem *
Following sets of jokes are allowed : {2},{2,3},{1,2},{1,2,3},{2,3,4},{1,2,3,4}