#include <bits/stdc++.h>
using namespace std;
const int mx = 1e3 + 10;
int a[mx], b[mx];
int main() {
  int n, k;
  scanf("%d", &n);
  for (int i = 1; i <= n; i++) scanf("%d%d", a + i, b + i);
  scanf("%d", &k);
  for (int i = 1; i <= n; i++)
    if (k <= b[i]) return 0 * printf("%d\n", n - i + 1);
  return 0;
}
