#include <bits/stdc++.h>
using namespace std;
const int MAXN = 2e6 + 1;
int a[MAXN];
int main() {
  ios::sync_with_stdio(false);
  int n;
  cin >> n;
  for (int i = 1; true; i++) {
    string s = to_string(n + i);
    for (int j = 0; j < s.length(); j++)
      if (s[j] == '8') return !(cout << i << endl);
  }
  cout << "MISTAKE" << endl;
}
