#include <bits/stdc++.h>
using namespace std;
#pragma comment(linker, "/stack:200000000")
int t, n, m, j, ans, k, a, b, c, d, e, f, sum, i, sz, row, col;
string s, s2, s3, s4;
vector<int> v;
int ar[2][(int)(1e6 + 10)], ar2[(int)(1e6 + 10)];
void brainfuck();
int main() {
  ios_base::sync_with_stdio(NULL);
  cin.tie(NULL);
  cout.tie(NULL);
  brainfuck();
  return 0;
}
void brainfuck() {
  cin >> n;
  for (i = 1; i <= n; i++) {
    cin >> ar[0][i] >> ar[1][i];
  }
  cin >> k;
  for (i = 1; i <= n; i++) {
    if (ar[0][i] < k && ar[1][i] < k)
      continue;
    else {
      cout << n - i + 1;
      return;
    }
  }
}
