#include <bits/stdc++.h>
using namespace std;
int n;
string s, p;
int main() {
  cin >> n;
  if (n <= 9) return cout << n << endl, 0;
  for (int i = 10; i <= n; ++i) {
    int x = i;
    char ch;
    s = "";
    while (x > 0) {
      ch = (x % 10) + '0';
      s = ch + s;
      x /= 10;
    }
    p += s;
  }
  cout << p[n - 10] << endl;
  return 0;
}
