#include <bits/stdc++.h>
using namespace std;
const long long mod = 1000000007;
const double eps = 1e-9;
long double pi = 3.14159265358979323846264338327950;
long double e = 2.7182818284590452353602874713527;
bool L(int cr) {
  bool contain8 = 0;
  stringstream ss;
  ss << cr;
  string s = ss.str();
  for (int i = 0; i < ((int)(s).size()); i++) {
    contain8 |= (s[i] == '8');
  }
  return contain8;
}
int main() {
  ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
  int a, b, ans = 0;
  cin >> a;
  b = a;
  while (1) {
    if (L(b) && b > a) break;
    ans++;
    b++;
  }
  cout << ans << endl;
  return 0;
}
