#include <bits/stdc++.h>
using namespace std;
long long n, m, a, k, tmp;
bool solve(int m) {
  string s = to_string(m);
  for (int i = 0; i < s.size(); i++) {
    if (s[i] == '8') {
      return 1;
    }
  }
  return 0;
}
int main() {
  ios::sync_with_stdio(false);
  cin >> n;
  while (true) {
    tmp++;
    n++;
    if (solve(n)) {
      cout << tmp;
      return 0;
    }
  }
  cout << tmp;
}
