eolymp
bolt
Try our new interface for solving problems
Problems

City of Lights

City of Lights

Paris has been called "ville lumière" (city of lights) since the 17th century. It earned this nickname in part because of the many city lights illuminating famous sites such as monuments, statues, churches, or fountains. Those public lights in Paris are numbered from $1$ to $n$ and are all on by default. A group of hackers has gained the capability to toggle groups of lights. Every time the hackers use their program, they cause a number $i$ (that they cannot control) to be sent to the system controlling the city lights. The lights numbered $i, 2i, 3i$ and so on (up to $n$) then change state instantly: lights that were on go off, and lights that were off go on. During the night, the hackers use their programs $k$ times. What is the greatest number of lights that are simultaneously off at the same time? \InputFile Consists of several lines, each consisting of a single integer: \begin{itemize} \item The first line contains the number $n~(1 \le n \le 10^6)$ of lights. \item The second line contains the number $k~(1 \le k \le 100)$ of uses hackers’s program. \item The next $k$ lines contain a number $i~(1 \le i \le n)$ sent to the system controlling the lights. \end{itemize} \OutputFile Print one integer, the greatest number of lights that are simultaneously off at the same time. \includegraphics{https://static.e-olymp.com/content/c3/c3199187f86cbb7b429ad6838f089cf7edc1aff6.gif}
Time limit 1 second
Memory limit 128 MiB
Input example #1
10
4
6
2
1
3
Output example #1
6
Source 2018 ACM Southwestern Europe Regional Contest (SWERC), Paris, December 2, Problem A