#include <bits/stdc++.h>
using namespace std;
bool check(long long x, int &count) {
  count++;
  string s = to_string(x);
  for (int i = 0; i < s.length(); i++)
    if (s[i] == '8') return true;
  return false;
}
int main() {
  long long n;
  int count{};
  cin >> n;
  string s = to_string(n);
  for (long long i = n + 1;; i++) {
    if (check(i, count)) {
      cout << count << endl;
      break;
    }
  }
}
