#include <bits/stdc++.h>
using namespace std;
const int INF = 0x3f3f3f3f;
const int MAXN = 1000;
const int MAXM = 20500;
struct Node {
  int from, to, next;
  int cap;
} edge[MAXM];
int tol;
int dep[MAXN];
int head[MAXN];
void init() {
  tol = 0;
  memset(head, -1, sizeof(head));
}
void addedge(int u, int v, int w) {
  edge[tol].from = u;
  edge[tol].to = v;
  edge[tol].cap = w;
  edge[tol].next = head[u];
  head[u] = tol++;
  edge[tol].from = v;
  edge[tol].to = u;
  edge[tol].cap = 0;
  edge[tol].next = head[v];
  head[v] = tol++;
}
int BFS(int start, int end) {
  int que[MAXN];
  int front, rear;
  front = rear = 0;
  memset(dep, -1, sizeof(dep));
  que[rear++] = start;
  dep[start] = 0;
  while (front != rear) {
    int u = que[front++];
    if (front == MAXN) front = 0;
    for (int i = head[u]; i != -1; i = edge[i].next) {
      int v = edge[i].to;
      if (edge[i].cap > 0 && dep[v] == -1) {
        dep[v] = dep[u] + 1;
        que[rear++] = v;
        if (rear >= MAXN) rear = 0;
        if (v == end) return 1;
      }
    }
  }
  return 0;
}
int dinic(int start, int end) {
  int res = 0;
  int top;
  int stack[MAXN];
  int cur[MAXN];
  while (BFS(start, end)) {
    memcpy(cur, head, sizeof(head));
    int u = start;
    top = 0;
    while (1) {
      if (u == end) {
        int min = INF;
        int loc;
        for (int i = 0; i < top; i++)
          if (min > edge[stack[i]].cap) {
            min = edge[stack[i]].cap;
            loc = i;
          }
        for (int i = 0; i < top; i++) {
          edge[stack[i]].cap -= min;
          edge[stack[i] ^ 1].cap += min;
        }
        res += min;
        top = loc;
        u = edge[stack[top]].from;
      }
      for (int i = cur[u]; i != -1; cur[u] = i = edge[i].next)
        if (edge[i].cap != 0 && dep[u] + 1 == dep[edge[i].to]) break;
      if (cur[u] != -1) {
        stack[top++] = cur[u];
        u = edge[cur[u]].to;
      } else {
        if (top == 0) break;
        dep[u] = -1;
        u = edge[stack[--top]].from;
      }
    }
  }
  return res;
}
int n, m, a[105], x[105], y[105], h[105];
int slove(int num) {
  int i, j;
  init();
  memset(h, 0, sizeof(h));
  for (i = 1; i <= n; i++) {
    int tmp = a[i];
    while (tmp % num == 0) tmp /= num, h[i]++;
  }
  int start = 0, end = n + 1;
  for (i = 1; i <= n; i++) {
    if (i & 1)
      addedge(start, i, h[i]);
    else
      addedge(i, end, h[i]);
  }
  for (i = 1; i <= m; i++) {
    if (x[i] % 2 == 1)
      addedge(x[i], y[i], INF);
    else
      addedge(y[i], x[i], INF);
  }
  return dinic(start, end);
}
int main() {
  init();
  scanf("%d%d", &n, &m);
  for (int i = 1; i <= n; i++) {
    scanf("%d", &a[i]);
  }
  for (int i = 1; i <= m; i++) {
    scanf("%d%d", &x[i], &y[i]);
  }
  int i, j;
  set<int> s;
  for (int i = 0; i < n; i++) {
    int key = a[i];
    for (int k = 2; key > 1;) {
      if (key % k == 0) {
        s.insert(k);
        for (; key % k == 0; key /= k)
          ;
      }
      if (k == 2)
        k++;
      else
        k += 2;
      if (k * k > key) k = key;
    }
  }
  int ans = 0;
  for (set<int>::iterator it = s.begin(); it != s.end(); ++it) {
    int key = *it;
    if (key == 0) continue;
    ans += slove(key);
  }
  cout << ans << endl;
  return 0;
}

### Prompt

Create a solution in cpp for the following problem:

You have written on a piece of paper an array of n positive integers a[1], a[2], ..., a[n] and m good pairs of integers (i1, j1), (i2, j2), ..., (im, jm). Each good pair (ik, jk) meets the following conditions: ik + jk is an odd number and 1 ≤ ik < jk ≤ n.

In one operation you can perform a sequence of actions: 

  * take one of the good pairs (ik, jk) and some integer v (v > 1), which divides both numbers a[ik] and a[jk]; 
  * divide both numbers by v, i. e. perform the assignments: <image> and <image>. 



Determine the maximum number of operations you can sequentially perform on the given array. Note that one pair may be used several times in the described operations.

Input

The first line contains two space-separated integers n, m (2 ≤ n ≤ 100, 1 ≤ m ≤ 100).

The second line contains n space-separated integers a[1], a[2], ..., a[n] (1 ≤ a[i] ≤ 109) — the description of the array.

The following m lines contain the description of good pairs. The k-th line contains two space-separated integers ik, jk (1 ≤ ik < jk ≤ n, ik + jk is an odd number).

It is guaranteed that all the good pairs are distinct.

Output

Output the answer for the problem.

Examples

Input

3 2
8 3 8
1 2
2 3


Output

0


Input

3 2
8 12 8
1 2
2 3


Output

2

### Response

```cpp
#include <bits/stdc++.h>
using namespace std;
const int INF = 0x3f3f3f3f;
const int MAXN = 1000;
const int MAXM = 20500;
struct Node {
  int from, to, next;
  int cap;
} edge[MAXM];
int tol;
int dep[MAXN];
int head[MAXN];
void init() {
  tol = 0;
  memset(head, -1, sizeof(head));
}
void addedge(int u, int v, int w) {
  edge[tol].from = u;
  edge[tol].to = v;
  edge[tol].cap = w;
  edge[tol].next = head[u];
  head[u] = tol++;
  edge[tol].from = v;
  edge[tol].to = u;
  edge[tol].cap = 0;
  edge[tol].next = head[v];
  head[v] = tol++;
}
int BFS(int start, int end) {
  int que[MAXN];
  int front, rear;
  front = rear = 0;
  memset(dep, -1, sizeof(dep));
  que[rear++] = start;
  dep[start] = 0;
  while (front != rear) {
    int u = que[front++];
    if (front == MAXN) front = 0;
    for (int i = head[u]; i != -1; i = edge[i].next) {
      int v = edge[i].to;
      if (edge[i].cap > 0 && dep[v] == -1) {
        dep[v] = dep[u] + 1;
        que[rear++] = v;
        if (rear >= MAXN) rear = 0;
        if (v == end) return 1;
      }
    }
  }
  return 0;
}
int dinic(int start, int end) {
  int res = 0;
  int top;
  int stack[MAXN];
  int cur[MAXN];
  while (BFS(start, end)) {
    memcpy(cur, head, sizeof(head));
    int u = start;
    top = 0;
    while (1) {
      if (u == end) {
        int min = INF;
        int loc;
        for (int i = 0; i < top; i++)
          if (min > edge[stack[i]].cap) {
            min = edge[stack[i]].cap;
            loc = i;
          }
        for (int i = 0; i < top; i++) {
          edge[stack[i]].cap -= min;
          edge[stack[i] ^ 1].cap += min;
        }
        res += min;
        top = loc;
        u = edge[stack[top]].from;
      }
      for (int i = cur[u]; i != -1; cur[u] = i = edge[i].next)
        if (edge[i].cap != 0 && dep[u] + 1 == dep[edge[i].to]) break;
      if (cur[u] != -1) {
        stack[top++] = cur[u];
        u = edge[cur[u]].to;
      } else {
        if (top == 0) break;
        dep[u] = -1;
        u = edge[stack[--top]].from;
      }
    }
  }
  return res;
}
int n, m, a[105], x[105], y[105], h[105];
int slove(int num) {
  int i, j;
  init();
  memset(h, 0, sizeof(h));
  for (i = 1; i <= n; i++) {
    int tmp = a[i];
    while (tmp % num == 0) tmp /= num, h[i]++;
  }
  int start = 0, end = n + 1;
  for (i = 1; i <= n; i++) {
    if (i & 1)
      addedge(start, i, h[i]);
    else
      addedge(i, end, h[i]);
  }
  for (i = 1; i <= m; i++) {
    if (x[i] % 2 == 1)
      addedge(x[i], y[i], INF);
    else
      addedge(y[i], x[i], INF);
  }
  return dinic(start, end);
}
int main() {
  init();
  scanf("%d%d", &n, &m);
  for (int i = 1; i <= n; i++) {
    scanf("%d", &a[i]);
  }
  for (int i = 1; i <= m; i++) {
    scanf("%d%d", &x[i], &y[i]);
  }
  int i, j;
  set<int> s;
  for (int i = 0; i < n; i++) {
    int key = a[i];
    for (int k = 2; key > 1;) {
      if (key % k == 0) {
        s.insert(k);
        for (; key % k == 0; key /= k)
          ;
      }
      if (k == 2)
        k++;
      else
        k += 2;
      if (k * k > key) k = key;
    }
  }
  int ans = 0;
  for (set<int>::iterator it = s.begin(); it != s.end(); ++it) {
    int key = *it;
    if (key == 0) continue;
    ans += slove(key);
  }
  cout << ans << endl;
  return 0;
}

```