#include <bits/stdc++.h>
using namespace std;
int main() {
  string ans, s;
  int n, t, p;
  char ch;
  scanf("%d", &n);
  ans.clear();
  for (int i = 1; i <= n; i++) {
    t = i;
    s.clear();
    while (t > 0) {
      p = t % 10;
      ch = p + '0';
      s = ch + s;
      t = t / 10;
    }
    ans = ans + s;
  }
  cout << ans[n - 1] << endl;
  return 0;
}
