#include <bits/stdc++.h>
using namespace std;
const int maxx = 1e3 + 10;
int a[maxx], n, k, ans;
int main() {
  int n;
  cin >> n;
  for (int i = 1; i <= 2 * n; i++) cin >> a[i];
  cin >> k;
  for (int i = 2; i <= 2 * n; i += 2) {
    if (k <= a[i]) {
      ans = n - (i / 2) + 1;
      cout << ans << endl;
      return 0;
    }
  }
}
