import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.Scanner;

public class Main {

    static PrintWriter out;
    static Scanner sc;

    static void solve() {
        int[][] c = new int[3][3];
        for (int i = 0; i < 3; i++) {
            for (int j = 0; j < 3; j++) {
                c[i][j] = nextInt();
            }
        }

        int[] a = new int[3];
        int[] b = new int[3];

        // a[0]は固定値と想定して問題ない
        a[0] = 0;

        for (int j = 0; j <= 2; j++) {
            b[j] = c[0][j] - a[0];
        }
        for (int i = 1; i <= 2; i++) {
            a[i] = c[i][0] - b[0];
        }

        boolean ok = true;
        for (int i = 1; i <= 2; i++) {
            for (int j = 1; j <= 2; j++) {
                if (c[i][j] != a[i] + b[j]) {
                    ok = false;
                    break;
                }
            }
            if (!ok) {
                break;
            }
        }

        if (ok) {
            out.println("Yes");
        } else {
            out.println("No");
        }
    }

    static int nextInt() {
        return Integer.parseInt(sc.next());
    }

    static long nextLong() {
        return Long.parseLong(sc.next());
    }

    static String nextString() {
        return sc.next();
    }

    static int[] nextIntArray(int n) {
        int[] a = new int[n];
        for (int i = 0; i < n; i++) {
            a[i] = nextInt();
        }
        return a;
    }

    static List<Integer> nextIntList(int n) {
        List<Integer> list = new ArrayList<>();
        for (int i = 0; i < n; i++) {
            list.add(nextInt());
        }
        return list;
    }

    static List<Long> nextLongList(int n) {
        List<Long> list = new ArrayList<>();
        for (int i = 0; i < n; i++) {
            list.add(nextLong());
        }
        return list;
    }

    static <T extends Comparable<? super T>> void sort(List<T> list) {
        Collections.sort(list);
    }

    // greatest common divisor
    static long gcd(long a, long b) {
        if (b == 0) {
            return a;
        }
        return gcd(b, a % b);
    }

    // baseのn乗を計算を返す
    static int pow(int base, int n) {
        int ret = 1;
        for (int i = 0; i < n; i++) {
            ret *= base;
        }
        return ret;
    }

    // intをlength桁のbit文字列に変換
    static String toBinaryString(int input, int length) {
        return toBinaryString(input).substring(29 - length);
    }

    // intを29桁のbit文字列に変換
    static String toBinaryString(int input) {
        String ret = "";
        int max = 0x10000000;
        for (int i = 0; i < 29; i++) {
            int tmp = input / max;
            ret += tmp;
            input %= max;
            max /= 2;
        }
        return ret;
    }

    public static void main(String[] args) {
        out = new PrintWriter(System.out);
        sc = new Scanner(System.in);

        solve();

        out.flush();
        sc.close();
    }

} import java.io.PrintWriter; PrintWriter java.io import java.util.ArrayList; ArrayList java.util import java.util.Collections; Collections java.util import java.util.List; List java.util import java.util.Scanner; Scanner java.util public class Main {

    static PrintWriter out;
    static Scanner sc;

    static void solve() {
        int[][] c = new int[3][3];
        for (int i = 0; i < 3; i++) {
            for (int j = 0; j < 3; j++) {
                c[i][j] = nextInt();
            }
        }

        int[] a = new int[3];
        int[] b = new int[3];

        // a[0]は固定値と想定して問題ない
        a[0] = 0;

        for (int j = 0; j <= 2; j++) {
            b[j] = c[0][j] - a[0];
        }
        for (int i = 1; i <= 2; i++) {
            a[i] = c[i][0] - b[0];
        }

        boolean ok = true;
        for (int i = 1; i <= 2; i++) {
            for (int j = 1; j <= 2; j++) {
                if (c[i][j] != a[i] + b[j]) {
                    ok = false;
                    break;
                }
            }
            if (!ok) {
                break;
            }
        }

        if (ok) {
            out.println("Yes");
        } else {
            out.println("No");
        }
    }

    static int nextInt() {
        return Integer.parseInt(sc.next());
    }

    static long nextLong() {
        return Long.parseLong(sc.next());
    }

    static String nextString() {
        return sc.next();
    }

    static int[] nextIntArray(int n) {
        int[] a = new int[n];
        for (int i = 0; i < n; i++) {
            a[i] = nextInt();
        }
        return a;
    }

    static List<Integer> nextIntList(int n) {
        List<Integer> list = new ArrayList<>();
        for (int i = 0; i < n; i++) {
            list.add(nextInt());
        }
        return list;
    }

    static List<Long> nextLongList(int n) {
        List<Long> list = new ArrayList<>();
        for (int i = 0; i < n; i++) {
            list.add(nextLong());
        }
        return list;
    }

    static <T extends Comparable<? super T>> void sort(List<T> list) {
        Collections.sort(list);
    }

    // greatest common divisor
    static long gcd(long a, long b) {
        if (b == 0) {
            return a;
        }
        return gcd(b, a % b);
    }

    // baseのn乗を計算を返す
    static int pow(int base, int n) {
        int ret = 1;
        for (int i = 0; i < n; i++) {
            ret *= base;
        }
        return ret;
    }

    // intをlength桁のbit文字列に変換
    static String toBinaryString(int input, int length) {
        return toBinaryString(input).substring(29 - length);
    }

    // intを29桁のbit文字列に変換
    static String toBinaryString(int input) {
        String ret = "";
        int max = 0x10000000;
        for (int i = 0; i < 29; i++) {
            int tmp = input / max;
            ret += tmp;
            input %= max;
            max /= 2;
        }
        return ret;
    }

    public static void main(String[] args) {
        out = new PrintWriter(System.out);
        sc = new Scanner(System.in);

        solve();

        out.flush();
        sc.close();
    }

} Main static PrintWriter out; out static Scanner sc; sc static void solve() {
        int[][] c = new int[3][3];
        for (int i = 0; i < 3; i++) {
            for (int j = 0; j < 3; j++) {
                c[i][j] = nextInt();
            }
        }

        int[] a = new int[3];
        int[] b = new int[3];

        // a[0]は固定値と想定して問題ない
        a[0] = 0;

        for (int j = 0; j <= 2; j++) {
            b[j] = c[0][j] - a[0];
        }
        for (int i = 1; i <= 2; i++) {
            a[i] = c[i][0] - b[0];
        }

        boolean ok = true;
        for (int i = 1; i <= 2; i++) {
            for (int j = 1; j <= 2; j++) {
                if (c[i][j] != a[i] + b[j]) {
                    ok = false;
                    break;
                }
            }
            if (!ok) {
                break;
            }
        }

        if (ok) {
            out.println("Yes");
        } else {
            out.println("No");
        }
    } solve {
        int[][] c = new int[3][3];
        for (int i = 0; i < 3; i++) {
            for (int j = 0; j < 3; j++) {
                c[i][j] = nextInt();
            }
        }

        int[] a = new int[3];
        int[] b = new int[3];

        // a[0]は固定値と想定して問題ない
        a[0] = 0;

        for (int j = 0; j <= 2; j++) {
            b[j] = c[0][j] - a[0];
        }
        for (int i = 1; i <= 2; i++) {
            a[i] = c[i][0] - b[0];
        }

        boolean ok = true;
        for (int i = 1; i <= 2; i++) {
            for (int j = 1; j <= 2; j++) {
                if (c[i][j] != a[i] + b[j]) {
                    ok = false;
                    break;
                }
            }
            if (!ok) {
                break;
            }
        }

        if (ok) {
            out.println("Yes");
        } else {
            out.println("No");
        }
    } int[][] c = new int[3][3]; c new int[3][3] 3 3 for (int i = 0; i < 3; i++) {
            for (int j = 0; j < 3; j++) {
                c[i][j] = nextInt();
            }
        } int i = 0; int i = 0; i 0 i < 3 i 3 i++ i++ i {
            for (int j = 0; j < 3; j++) {
                c[i][j] = nextInt();
            }
        } {
            for (int j = 0; j < 3; j++) {
                c[i][j] = nextInt();
            }
        } for (int j = 0; j < 3; j++) {
                c[i][j] = nextInt();
            } int j = 0; int j = 0; j 0 j < 3 j 3 j++ j++ j {
                c[i][j] = nextInt();
            } {
                c[i][j] = nextInt();
            } c[i][j] = nextInt() c[i][j] c[i] c i j nextInt() nextInt int[] a = new int[3]; a new int[3] 3 int[] b = new int[3]; b new int[3] 3 a[0] = 0 a[0] a 0 0 for (int j = 0; j <= 2; j++) {
            b[j] = c[0][j] - a[0];
        } int j = 0; int j = 0; j 0 j <= 2 j 2 j++ j++ j {
            b[j] = c[0][j] - a[0];
        } {
            b[j] = c[0][j] - a[0];
        } b[j] = c[0][j] - a[0] b[j] b j c[0][j] - a[0] c[0][j] c[0] c 0 j a[0] a 0 for (int i = 1; i <= 2; i++) {
            a[i] = c[i][0] - b[0];
        } int i = 1; int i = 1; i 1 i <= 2 i 2 i++ i++ i {
            a[i] = c[i][0] - b[0];
        } {
            a[i] = c[i][0] - b[0];
        } a[i] = c[i][0] - b[0] a[i] a i c[i][0] - b[0] c[i][0] c[i] c i 0 b[0] b 0 boolean ok = true; ok true for (int i = 1; i <= 2; i++) {
            for (int j = 1; j <= 2; j++) {
                if (c[i][j] != a[i] + b[j]) {
                    ok = false;
                    break;
                }
            }
            if (!ok) {
                break;
            }
        } int i = 1; int i = 1; i 1 i <= 2 i 2 i++ i++ i {
            for (int j = 1; j <= 2; j++) {
                if (c[i][j] != a[i] + b[j]) {
                    ok = false;
                    break;
                }
            }
            if (!ok) {
                break;
            }
        } {
            for (int j = 1; j <= 2; j++) {
                if (c[i][j] != a[i] + b[j]) {
                    ok = false;
                    break;
                }
            }
            if (!ok) {
                break;
            }
        } for (int j = 1; j <= 2; j++) {
                if (c[i][j] != a[i] + b[j]) {
                    ok = false;
                    break;
                }
            } int j = 1; int j = 1; j 1 j <= 2 j 2 j++ j++ j {
                if (c[i][j] != a[i] + b[j]) {
                    ok = false;
                    break;
                }
            } {
                if (c[i][j] != a[i] + b[j]) {
                    ok = false;
                    break;
                }
            } if (c[i][j] != a[i] + b[j]) {
                    ok = false;
                    break;
                } c[i][j] != a[i] + b[j] c[i][j] c[i] c i j a[i] + b[j] a[i] a i b[j] b j {
                    ok = false;
                    break;
                } ok = false ok false break; if (!ok) {
                break;
            } !ok ok {
                break;
            } break; if (ok) {
            out.println("Yes");
        } else {
            out.println("No");
        } ok {
            out.println("Yes");
        } out.println("Yes") out.println out "Yes" {
            out.println("No");
        } out.println("No") out.println out "No" static int nextInt() {
        return Integer.parseInt(sc.next());
    } nextInt {
        return Integer.parseInt(sc.next());
    } return Integer.parseInt(sc.next()); Integer.parseInt(sc.next()) Integer.parseInt Integer sc.next() sc.next sc static long nextLong() {
        return Long.parseLong(sc.next());
    } nextLong {
        return Long.parseLong(sc.next());
    } return Long.parseLong(sc.next()); Long.parseLong(sc.next()) Long.parseLong Long sc.next() sc.next sc static String nextString() {
        return sc.next();
    } nextString {
        return sc.next();
    } return sc.next(); sc.next() sc.next sc static int[] nextIntArray(int n) {
        int[] a = new int[n];
        for (int i = 0; i < n; i++) {
            a[i] = nextInt();
        }
        return a;
    } nextIntArray {
        int[] a = new int[n];
        for (int i = 0; i < n; i++) {
            a[i] = nextInt();
        }
        return a;
    } int[] a = new int[n]; a new int[n] n for (int i = 0; i < n; i++) {
            a[i] = nextInt();
        } int i = 0; int i = 0; i 0 i < n i n i++ i++ i {
            a[i] = nextInt();
        } {
            a[i] = nextInt();
        } a[i] = nextInt() a[i] a i nextInt() nextInt return a; a int n n static List<Integer> nextIntList(int n) {
        List<Integer> list = new ArrayList<>();
        for (int i = 0; i < n; i++) {
            list.add(nextInt());
        }
        return list;
    } nextIntList {
        List<Integer> list = new ArrayList<>();
        for (int i = 0; i < n; i++) {
            list.add(nextInt());
        }
        return list;
    } List<Integer> list = new ArrayList<>(); list new ArrayList<>() for (int i = 0; i < n; i++) {
            list.add(nextInt());
        } int i = 0; int i = 0; i 0 i < n i n i++ i++ i {
            list.add(nextInt());
        } {
            list.add(nextInt());
        } list.add(nextInt()) list.add list nextInt() nextInt return list; list int n n static List<Long> nextLongList(int n) {
        List<Long> list = new ArrayList<>();
        for (int i = 0; i < n; i++) {
            list.add(nextLong());
        }
        return list;
    } nextLongList {
        List<Long> list = new ArrayList<>();
        for (int i = 0; i < n; i++) {
            list.add(nextLong());
        }
        return list;
    } List<Long> list = new ArrayList<>(); list new ArrayList<>() for (int i = 0; i < n; i++) {
            list.add(nextLong());
        } int i = 0; int i = 0; i 0 i < n i n i++ i++ i {
            list.add(nextLong());
        } {
            list.add(nextLong());
        } list.add(nextLong()) list.add list nextLong() nextLong return list; list int n n static <T extends Comparable<? super T>> void sort(List<T> list) {
        Collections.sort(list);
    } sort {
        Collections.sort(list);
    } Collections.sort(list) Collections.sort Collections list List<T> list list // greatest common divisor
    static long gcd(long a, long b) {
        if (b == 0) {
            return a;
        }
        return gcd(b, a % b);
    } gcd {
        if (b == 0) {
            return a;
        }
        return gcd(b, a % b);
    } if (b == 0) {
            return a;
        } b == 0 b 0 {
            return a;
        } return a; a return gcd(b, a % b); gcd(b, a % b) gcd b a % b a b long a a long b b // baseのn乗を計算を返す
    static int pow(int base, int n) {
        int ret = 1;
        for (int i = 0; i < n; i++) {
            ret *= base;
        }
        return ret;
    } pow {
        int ret = 1;
        for (int i = 0; i < n; i++) {
            ret *= base;
        }
        return ret;
    } int ret = 1; ret 1 for (int i = 0; i < n; i++) {
            ret *= base;
        } int i = 0; int i = 0; i 0 i < n i n i++ i++ i {
            ret *= base;
        } {
            ret *= base;
        } ret *= base ret base return ret; ret int base base int n n // intをlength桁のbit文字列に変換
    static String toBinaryString(int input, int length) {
        return toBinaryString(input).substring(29 - length);
    } toBinaryString {
        return toBinaryString(input).substring(29 - length);
    } return toBinaryString(input).substring(29 - length); toBinaryString(input).substring(29 - length) toBinaryString(input).substring toBinaryString(input) toBinaryString input 29 - length 29 length int input input int length length // intを29桁のbit文字列に変換
    static String toBinaryString(int input) {
        String ret = "";
        int max = 0x10000000;
        for (int i = 0; i < 29; i++) {
            int tmp = input / max;
            ret += tmp;
            input %= max;
            max /= 2;
        }
        return ret;
    } toBinaryString {
        String ret = "";
        int max = 0x10000000;
        for (int i = 0; i < 29; i++) {
            int tmp = input / max;
            ret += tmp;
            input %= max;
            max /= 2;
        }
        return ret;
    } String ret = ""; ret "" int max = 0x10000000; max 0x10000000 for (int i = 0; i < 29; i++) {
            int tmp = input / max;
            ret += tmp;
            input %= max;
            max /= 2;
        } int i = 0; int i = 0; i 0 i < 29 i 29 i++ i++ i {
            int tmp = input / max;
            ret += tmp;
            input %= max;
            max /= 2;
        } {
            int tmp = input / max;
            ret += tmp;
            input %= max;
            max /= 2;
        } int tmp = input / max; tmp input / max input max ret += tmp ret tmp input %= max input max max /= 2 max 2 return ret; ret int input input public static void main(String[] args) {
        out = new PrintWriter(System.out);
        sc = new Scanner(System.in);

        solve();

        out.flush();
        sc.close();
    } main {
        out = new PrintWriter(System.out);
        sc = new Scanner(System.in);

        solve();

        out.flush();
        sc.close();
    } out = new PrintWriter(System.out) out new PrintWriter(System.out) sc = new Scanner(System.in) sc new Scanner(System.in) solve() solve out.flush() out.flush out sc.close() sc.close sc String[] args args public class Main {

    static PrintWriter out;
    static Scanner sc;

    static void solve() {
        int[][] c = new int[3][3];
        for (int i = 0; i < 3; i++) {
            for (int j = 0; j < 3; j++) {
                c[i][j] = nextInt();
            }
        }

        int[] a = new int[3];
        int[] b = new int[3];

        // a[0]は固定値と想定して問題ない
        a[0] = 0;

        for (int j = 0; j <= 2; j++) {
            b[j] = c[0][j] - a[0];
        }
        for (int i = 1; i <= 2; i++) {
            a[i] = c[i][0] - b[0];
        }

        boolean ok = true;
        for (int i = 1; i <= 2; i++) {
            for (int j = 1; j <= 2; j++) {
                if (c[i][j] != a[i] + b[j]) {
                    ok = false;
                    break;
                }
            }
            if (!ok) {
                break;
            }
        }

        if (ok) {
            out.println("Yes");
        } else {
            out.println("No");
        }
    }

    static int nextInt() {
        return Integer.parseInt(sc.next());
    }

    static long nextLong() {
        return Long.parseLong(sc.next());
    }

    static String nextString() {
        return sc.next();
    }

    static int[] nextIntArray(int n) {
        int[] a = new int[n];
        for (int i = 0; i < n; i++) {
            a[i] = nextInt();
        }
        return a;
    }

    static List<Integer> nextIntList(int n) {
        List<Integer> list = new ArrayList<>();
        for (int i = 0; i < n; i++) {
            list.add(nextInt());
        }
        return list;
    }

    static List<Long> nextLongList(int n) {
        List<Long> list = new ArrayList<>();
        for (int i = 0; i < n; i++) {
            list.add(nextLong());
        }
        return list;
    }

    static <T extends Comparable<? super T>> void sort(List<T> list) {
        Collections.sort(list);
    }

    // greatest common divisor
    static long gcd(long a, long b) {
        if (b == 0) {
            return a;
        }
        return gcd(b, a % b);
    }

    // baseのn乗を計算を返す
    static int pow(int base, int n) {
        int ret = 1;
        for (int i = 0; i < n; i++) {
            ret *= base;
        }
        return ret;
    }

    // intをlength桁のbit文字列に変換
    static String toBinaryString(int input, int length) {
        return toBinaryString(input).substring(29 - length);
    }

    // intを29桁のbit文字列に変換
    static String toBinaryString(int input) {
        String ret = "";
        int max = 0x10000000;
        for (int i = 0; i < 29; i++) {
            int tmp = input / max;
            ret += tmp;
            input %= max;
            max /= 2;
        }
        return ret;
    }

    public static void main(String[] args) {
        out = new PrintWriter(System.out);
        sc = new Scanner(System.in);

        solve();

        out.flush();
        sc.close();
    }

} public class Main {

    static PrintWriter out;
    static Scanner sc;

    static void solve() {
        int[][] c = new int[3][3];
        for (int i = 0; i < 3; i++) {
            for (int j = 0; j < 3; j++) {
                c[i][j] = nextInt();
            }
        }

        int[] a = new int[3];
        int[] b = new int[3];

        // a[0]は固定値と想定して問題ない
        a[0] = 0;

        for (int j = 0; j <= 2; j++) {
            b[j] = c[0][j] - a[0];
        }
        for (int i = 1; i <= 2; i++) {
            a[i] = c[i][0] - b[0];
        }

        boolean ok = true;
        for (int i = 1; i <= 2; i++) {
            for (int j = 1; j <= 2; j++) {
                if (c[i][j] != a[i] + b[j]) {
                    ok = false;
                    break;
                }
            }
            if (!ok) {
                break;
            }
        }

        if (ok) {
            out.println("Yes");
        } else {
            out.println("No");
        }
    }

    static int nextInt() {
        return Integer.parseInt(sc.next());
    }

    static long nextLong() {
        return Long.parseLong(sc.next());
    }

    static String nextString() {
        return sc.next();
    }

    static int[] nextIntArray(int n) {
        int[] a = new int[n];
        for (int i = 0; i < n; i++) {
            a[i] = nextInt();
        }
        return a;
    }

    static List<Integer> nextIntList(int n) {
        List<Integer> list = new ArrayList<>();
        for (int i = 0; i < n; i++) {
            list.add(nextInt());
        }
        return list;
    }

    static List<Long> nextLongList(int n) {
        List<Long> list = new ArrayList<>();
        for (int i = 0; i < n; i++) {
            list.add(nextLong());
        }
        return list;
    }

    static <T extends Comparable<? super T>> void sort(List<T> list) {
        Collections.sort(list);
    }

    // greatest common divisor
    static long gcd(long a, long b) {
        if (b == 0) {
            return a;
        }
        return gcd(b, a % b);
    }

    // baseのn乗を計算を返す
    static int pow(int base, int n) {
        int ret = 1;
        for (int i = 0; i < n; i++) {
            ret *= base;
        }
        return ret;
    }

    // intをlength桁のbit文字列に変換
    static String toBinaryString(int input, int length) {
        return toBinaryString(input).substring(29 - length);
    }

    // intを29桁のbit文字列に変換
    static String toBinaryString(int input) {
        String ret = "";
        int max = 0x10000000;
        for (int i = 0; i < 29; i++) {
            int tmp = input / max;
            ret += tmp;
            input %= max;
            max /= 2;
        }
        return ret;
    }

    public static void main(String[] args) {
        out = new PrintWriter(System.out);
        sc = new Scanner(System.in);

        solve();

        out.flush();
        sc.close();
    }

} Main
import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.Scanner;

public class Main {

    static PrintWriter out;
    static Scanner sc;

    static void solve() {
        int[][] c = new int[3][3];
        for (int i = 0; i < 3; i++) {
            for (int j = 0; j < 3; j++) {
                c[i][j] = nextInt();
            }
        }

        int[] a = new int[3];
        int[] b = new int[3];

        // a[0]は固定値と想定して問題ない
        a[0] = 0;

        for (int j = 0; j <= 2; j++) {
            b[j] = c[0][j] - a[0];
        }
        for (int i = 1; i <= 2; i++) {
            a[i] = c[i][0] - b[0];
        }

        boolean ok = true;
        for (int i = 1; i <= 2; i++) {
            for (int j = 1; j <= 2; j++) {
                if (c[i][j] != a[i] + b[j]) {
                    ok = false;
                    break;
                }
            }
            if (!ok) {
                break;
            }
        }

        if (ok) {
            out.println("Yes");
        } else {
            out.println("No");
        }
    }

    static int nextInt() {
        return Integer.parseInt(sc.next());
    }

    static long nextLong() {
        return Long.parseLong(sc.next());
    }

    static String nextString() {
        return sc.next();
    }

    static int[] nextIntArray(int n) {
        int[] a = new int[n];
        for (int i = 0; i < n; i++) {
            a[i] = nextInt();
        }
        return a;
    }

    static List<Integer> nextIntList(int n) {
        List<Integer> list = new ArrayList<>();
        for (int i = 0; i < n; i++) {
            list.add(nextInt());
        }
        return list;
    }

    static List<Long> nextLongList(int n) {
        List<Long> list = new ArrayList<>();
        for (int i = 0; i < n; i++) {
            list.add(nextLong());
        }
        return list;
    }

    static <T extends Comparable<? super T>> void sort(List<T> list) {
        Collections.sort(list);
    }

    // greatest common divisor
    static long gcd(long a, long b) {
        if (b == 0) {
            return a;
        }
        return gcd(b, a % b);
    }

    // baseのn乗を計算を返す
    static int pow(int base, int n) {
        int ret = 1;
        for (int i = 0; i < n; i++) {
            ret *= base;
        }
        return ret;
    }

    // intをlength桁のbit文字列に変換
    static String toBinaryString(int input, int length) {
        return toBinaryString(input).substring(29 - length);
    }

    // intを29桁のbit文字列に変換
    static String toBinaryString(int input) {
        String ret = "";
        int max = 0x10000000;
        for (int i = 0; i < 29; i++) {
            int tmp = input / max;
            ret += tmp;
            input %= max;
            max /= 2;
        }
        return ret;
    }

    public static void main(String[] args) {
        out = new PrintWriter(System.out);
        sc = new Scanner(System.in);

        solve();

        out.flush();
        sc.close();
    }

}
