Under construction

Still being built. Things may change

Light

Time limit2sMemory limit1024 MB

Summary
Given N bulbs and K divisors d_i, count the bulbs that are flipped an odd number of times.
Level

Medium6 of 10

Topics
Combinatorics, Number theory, Bit manipulation
Solved
No attempts yet

Statement

In the physics lab, NN light bulbs are lined up in a row, numbered from 1 to NN. All bulbs are off at first. During class, each of the KK students picks an integer did_i (2≤di≤N2 \le d_i \le N). The student flips the state of every bulb whose number is a multiple of did_i. A bulb that is on turns off, and a bulb that is off turns on. After flipping, the student leaves the room.

Write a program that counts the bulbs that are still on after all students have left.

Input

The first line contains the positive integer NN. The second line contains the number of students KK. The third line contains KK integers d1,d2,…,dKd_1, d_2, \ldots, d_K, separated by single spaces.

Output

Print a single line containing the number of bulbs that remain on after all students have left.

Constraints

  • 3≤N≤10123 \le N \le 10^{12}
  • 1≤K≤221 \le K \le 22
  • 1≤di≤min⁡(N,106)1 \le d_i \le \min(N, 10^6)
  • The numbers did_i are not necessarily distinct

Hint

Initially, all the bulbs are off. After the first student flips the bulbs, the 2nd, 4th, 6th, and 8th bulbs are on. After the second student flips the bulbs, the 2nd, 3rd, 4th, and 8th bulbs remain on.

Examples1

  1. Example 1

    Input
    8
    2
    2 3
    
    Expected output
    4