#include <bits/stdc++.h>
using namespace std;
int main() {
  long long X, Z = 0;
  cin >> X;
  int l = 0;
  bool yes = false;
  while (true) {
    X++;
    Z = X;
    l++;
    while (Z != 0) {
      int digit = Z % 10;
      Z /= 10;
      if (digit == 8 || digit == -8) {
        yes = true;
        break;
      }
    }
    if (yes == true) {
      break;
    }
  }
  cout << l << endl;
  return 0;
}
