#include <bits/stdc++.h>
using namespace std;
bool digit(long long int n) {
  while (n) {
    long long m = (abs(n) % 10);
    if (m == 8)
      return true;
    else
      n /= 10;
  }
  return false;
}
int main() {
  long long int n;
  cin >> n;
  int count = 1;
  n++;
  while (!digit(n++)) count++;
  cout << count;
  return 0;
}
