#include <bits/stdc++.h>
int n, m;
int main() {
  std::cin >> n;
  for (int i = 1;; i++) {
    for (m = abs(n + i); m; m /= 10) {
      if (m % 10 == 8) {
        std::cout << i;
        return 0;
      }
    }
  }
}
