#include <bits/stdc++.h>
using namespace std;
const int nax = 1e5 + 5;
int A[nax];
vector<int> adj[nax];
int n, m, maxd;
int a, b, c;
int dist1[nax], dist2[nax], dist3[nax];
void bfs(int s, int* dist) {
  dist[s] = 0;
  queue<pair<int, int> > Q;
  Q.push({s, 0});
  while (!Q.empty()) {
    pair<int, int> cur = Q.front();
    Q.pop();
    int u = cur.first, p = cur.second;
    for (int v : adj[u])
      if (v != p) {
        dist[v] = dist[u] + 1;
        Q.push({v, u});
      }
  }
}
int main() {
  cin >> n >> m >> maxd;
  for (int i = 0; i < m; i++) cin >> A[i];
  for (int i = 0; i < n - 1; i++) {
    int u, v;
    cin >> u >> v;
    adj[u].push_back(v);
    adj[v].push_back(u);
  }
  if (m == 1) {
    a = b = c = A[0];
    bfs(a, dist1);
    bfs(b, dist1);
    bfs(c, dist1);
  } else {
    a = A[0];
    bfs(a, dist1);
    b = A[1];
    for (int i = 2; i < m; i++)
      if (dist1[A[i]] > dist1[b]) b = A[i];
    bfs(b, dist2);
    c = A[1];
    for (int i = 2; i < m; i++)
      if (dist1[A[i]] + dist2[A[i]] > dist1[c] + dist2[c]) c = A[i];
    bfs(c, dist3);
  }
  int ans = 0;
  for (int i = 1; i <= n; i++)
    if (dist1[i] <= maxd && dist2[i] <= maxd && dist3[i] <= maxd) ans++;
  cout << ans << endl;
  return 0;
}

### Prompt

Please provide a Cpp coded solution to the problem described below:

Paladin Manao caught the trail of the ancient Book of Evil in a swampy area. This area contains n settlements numbered from 1 to n. Moving through the swamp is very difficult, so people tramped exactly n - 1 paths. Each of these paths connects some pair of settlements and is bidirectional. Moreover, it is possible to reach any settlement from any other one by traversing one or several paths.

The distance between two settlements is the minimum number of paths that have to be crossed to get from one settlement to the other one. Manao knows that the Book of Evil has got a damage range d. This means that if the Book of Evil is located in some settlement, its damage (for example, emergence of ghosts and werewolves) affects other settlements at distance d or less from the settlement where the Book resides.

Manao has heard of m settlements affected by the Book of Evil. Their numbers are p1, p2, ..., pm. Note that the Book may be affecting other settlements as well, but this has not been detected yet. Manao wants to determine which settlements may contain the Book. Help him with this difficult task.

Input

The first line contains three space-separated integers n, m and d (1 ≤ m ≤ n ≤ 100000; 0 ≤ d ≤ n - 1). The second line contains m distinct space-separated integers p1, p2, ..., pm (1 ≤ pi ≤ n). Then n - 1 lines follow, each line describes a path made in the area. A path is described by a pair of space-separated integers ai and bi representing the ends of this path.

Output

Print a single number — the number of settlements that may contain the Book of Evil. It is possible that Manao received some controversial information and there is no settlement that may contain the Book. In such case, print 0.

Examples

Input

6 2 3
1 2
1 5
2 3
3 4
4 5
5 6


Output

3

Note

Sample 1. The damage range of the Book of Evil equals 3 and its effects have been noticed in settlements 1 and 2. Thus, it can be in settlements 3, 4 or 5.

<image>

### Response

```cpp
#include <bits/stdc++.h>
using namespace std;
const int nax = 1e5 + 5;
int A[nax];
vector<int> adj[nax];
int n, m, maxd;
int a, b, c;
int dist1[nax], dist2[nax], dist3[nax];
void bfs(int s, int* dist) {
  dist[s] = 0;
  queue<pair<int, int> > Q;
  Q.push({s, 0});
  while (!Q.empty()) {
    pair<int, int> cur = Q.front();
    Q.pop();
    int u = cur.first, p = cur.second;
    for (int v : adj[u])
      if (v != p) {
        dist[v] = dist[u] + 1;
        Q.push({v, u});
      }
  }
}
int main() {
  cin >> n >> m >> maxd;
  for (int i = 0; i < m; i++) cin >> A[i];
  for (int i = 0; i < n - 1; i++) {
    int u, v;
    cin >> u >> v;
    adj[u].push_back(v);
    adj[v].push_back(u);
  }
  if (m == 1) {
    a = b = c = A[0];
    bfs(a, dist1);
    bfs(b, dist1);
    bfs(c, dist1);
  } else {
    a = A[0];
    bfs(a, dist1);
    b = A[1];
    for (int i = 2; i < m; i++)
      if (dist1[A[i]] > dist1[b]) b = A[i];
    bfs(b, dist2);
    c = A[1];
    for (int i = 2; i < m; i++)
      if (dist1[A[i]] + dist2[A[i]] > dist1[c] + dist2[c]) c = A[i];
    bfs(c, dist3);
  }
  int ans = 0;
  for (int i = 1; i <= n; i++)
    if (dist1[i] <= maxd && dist2[i] <= maxd && dist3[i] <= maxd) ans++;
  cout << ans << endl;
  return 0;
}

```