#include <bits/stdc++.h>
const double eps = 1e-6;
const long double eps2 = 1e-18;
using namespace std;
int l[101], N, r[101], q;
int main(void) {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  cin >> N;
  for (int i = 1, nn = (N); i <= nn; ++i) {
    cin >> l[i] >> r[i];
  }
  cin >> q;
  int res = 1;
  for (; res <= N; res++) {
    if (q >= l[res] && q <= r[res]) break;
  }
  res--;
  cout << N - res << endl;
}
