#include <bits/stdc++.h>
using namespace std;
bool Notlucky(int x) {
  for (int i = x; i != 0; i /= 10) {
    if (i % 10 == 8 || i % 10 == -8) return false;
  }
  return true;
}
int main() {
  int a, b;
  cin >> a;
  b = a + 1;
  while (Notlucky(b)) {
    b++;
  }
  cout << b - a;
  return 0;
}
