#include <bits/stdc++.h>
using namespace std;
bool je(int a) {
  a = max(a, -a);
  while (a > 0) {
    if (a % 10 == 8) return true;
    a = a / 10;
  }
  return false;
}
int main() {
  int kolo = 1, n;
  cin >> n;
  n++;
  while (!je(n)) {
    kolo++;
    n++;
  }
  cout << kolo << endl;
  return 0;
}
