A simple undirected graph has vertices and edges. Its vertices are numbered from to . Each vertex is assigned one of colors, and the color of vertex is .
A matching is a set of edges in which no two edges share an endpoint. The endpoints of edges in a matching are called the vertices covered by that matching.
An integer is given for each color . Find the maximum size of a matching satisfying the following condition. The size of a matching is its number of edges.
The input is given in the following format:
Print the maximum size of a matching satisfying the condition.
For each (), there is an edge between and . If , there are no edge lines.