#include <bits/stdc++.h>
using namespace std;
struct node {
  int x;
  int y;
} i[200];
int main() {
  int a, b, c, d, n, m;
  cin >> n;
  for (a = 1; a <= n; a++) scanf("%d%d", &i[a].x, &i[a].y);
  cin >> m;
  int sum = 0;
  for (a = 1; a <= n; a++) {
    if (m > i[a].y) sum++;
    if (m <= i[a].y) break;
  }
  cout << n - sum << endl;
  return 0;
}
