#include <bits/stdc++.h>
using namespace std;
int main() {
  long long source(0);
  short cnt(1);
  cin >> source;
  string str;
  source++;
  bool flag = false;
  while (true) {
    str = to_string(source);
    for (int i = 0; i < str.size(); ++i) {
      if (str[i] == '8') {
        flag = true;
        break;
      }
    }
    if (flag) break;
    source++;
    cnt++;
  }
  cout << cnt << endl;
  return 0;
}
