#include <bits/stdc++.h>
using namespace std;
int main() {
  int k, n, i = 0, j = 0, a[2000], x, l;
  string s;
  cin >> n;
  while (j < n) {
    i++;
    x = i;
    s = "";
    while (x > 0) {
      s = char(x % 10 + int('0')) + s;
      x = x / 10;
    }
    l = s.length();
    for (k = 0; k < l; k++) {
      j++;
      a[j] = int(s[k]) - int('0');
    }
  }
  cout << a[n];
  return 0;
}
