#include <bits/stdc++.h>
using namespace std;
bool chek(int h) {
  while (h) {
    if (abs(h) % 10 == 8) {
      return 1;
    }
    h /= 10;
  }
  return 0;
}
int main() {
  int a, m;
  cin >> a;
  m = a;
  a++;
  while (1) {
    if (chek(a)) {
      cout << a - m;
      return 0;
    }
    a++;
  }
}
