#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  cin >> n;
  string x;
  for (int i = 1; i <= n; i++) {
    stringstream c;
    c << i;
    string nc;
    c >> nc;
    x += nc;
  }
  cout << x[n - 1] << endl;
  return 0;
}
