#include <bits/stdc++.h>
using namespace std;
const int N6 = 1e6 + 6, N3 = 1e3 + 6, oo = 1e9 + 9, base = 1e9 + 7;
const long long ool = 1e18 + 9;
int main() {
  ios_base ::sync_with_stdio(0);
  cin.tie(0);
  int n;
  cin >> n;
  int x = 0;
  while (1) {
    ++x;
    int q = x;
    vector<int> v;
    while (q) {
      v.push_back(q % 10);
      q /= 10;
    }
    if (v.size() < n) {
      n -= v.size();
      continue;
    }
    cout << v[(int)v.size() - n] << "\n";
    break;
  }
  return 0;
}
