    #include <bits/stdc++.h>
    #define SpeeD ios_base::sync_with_stdio(0),cin.tie(0),cout.tie(0);
    
    #define ll long long
    #define endl '\n'
    using namespace std;
     ll n , t , k  , m;
      bool nud(int n)
    {
        int a[100];
 int c= 0 ;
        // counter for octal number array
        int i = 0;
        while (n != 0) {
            // storing remainder in octal array
            a[i] = n % 8;
            n = n / 8;
            i++;
        }
 
        for (int i  =  0 ; i < 100; i++)
        if (a[i] == 7 )c++;
        return c;
    }
    bool num (int x)
    {
        int c= 0 ;
        while (x)
        {
            if (x%10 == 7)c++;
            x/=10;
        }
        return c;
    }
 
    int main(){
     SpeeD;
      int n;
      cin >> n;
      long long sum =  0 ;
     // cout << nud(15);
      for (int i =  1 ; i <=n ;  i++)
      {
       // cout << i <<" " << num(i) <<" " << nud(i) << endl;
          sum = sum +  ( num(i) | nud(i));
          
      }
      cout << n-  sum;
     
      
      
}
#include <stdio.h>
#include <iostream>
#include <stdlib.h>
#include <vector>
using namespace std;
int X;
 
int main(){
  cin >> X;
  
  cout << 100-X%100;
}