#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  cin >> n;
  string s, stemp;
  char c;
  int sch = 0;
  int temp;
  for (int i = 1; i <= n; i++) {
    temp = i;
    stemp = "";
    while (temp > 0) {
      c = char(temp % 10 + '0');
      stemp = c + stemp;
      temp /= 10;
    }
    s = s + stemp;
    if (s.length() >= n) {
      break;
    }
  }
  cout << s[n - 1] << endl;
  return 0;
}
