#![allow(non_snake_case)]
#![allow(unused_variables)]
#![allow(dead_code)]

fn main() {
    let (x, y): (i64, i64) = {
        let mut line: String = String::new();
        std::io::stdin().read_line(&mut line).unwrap();
        let mut iter = line.split_whitespace();
        (
            iter.next().unwrap().parse().unwrap(),
            iter.next().unwrap().parse().unwrap()
        )
    };

    let g: std::collections::HashSet<i64> = vec![4, 6, 9, 11].into_iter().collect::<_>();
    let ans = if x == y || g.contains(&x) && g.contains(&y) || x != 2 && !g.contains(&x) && !g.contains(&y) {
        "Yes"
    } else {
        "No"
    };

    println!("{}", ans);
}


// Template from https://techracho.bpsinc.jp/jhonda/2019_08_05/78537

// input macro for competive-programming from https://qiita.com/tanakh/items/0ba42c7ca36cd29d0ac8
#[allow(unused_macros)]
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
}

#[allow(unused_macros)]
macro_rules! input_inner {
    ($iter:expr) => {};
    ($iter:expr, ) => {};

    ($iter:expr, $var:ident : $t:tt $($r:tt)*) => {
        let $var = read_value!($iter, $t);
        input_inner!{$iter $($r)*}
    };

    ($iter:expr, mut $var:ident : $t:tt $($r:tt)*) => {
        let mut $var = read_value!($iter, $t);
        input_inner!{$iter $($r)*}
    };
}

#[allow(unused_macros)]
macro_rules! read_value {
    ($iter:expr, ( $($t:tt),* )) => {
        ( $(read_value!($iter, $t)),* )
    };

    ($iter:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($iter, $t)).collect::<Vec<_>>()
    };

    ($next:expr, [ $t:tt ]) => {
        {
            let len = read_value!($next, usize);
            (0..len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()
        }
    };

    ($iter:expr, chars) => {
        read_value!($iter, String).chars().collect::<Vec<char>>()
    };

    ($iter:expr, bytes) => {
        read_value!($iter, String).into_bytes()
    };

    ($iter:expr, $t:ty) => {
        $iter.next().unwrap().parse::<$t>().expect("Parse error")
    };
}

fn main() {
    use std::io::Read;
    let mut s = String::new();
    std::io::stdin().read_to_string(&mut s).unwrap();

    println!("{}", solve(&s));
}

macro_rules! test {
    ($($input:expr => $output:expr),* $(,)*) => {
        #[test]
        fn solve_test() {
            $(
                assert_eq!(solve($input), $output);
            )*
        }
    };
}

test! {
r#"a b c"# => r#"ABC"#,
}

fn solve(src: &str) -> String {
    input! {
        source = src,
        x: isize,
        y: isize,
    }

    let f:[isize; 7] = [1, 3, 5, 7, 8, 10, 12];
    let s:[isize; 4] = [4, 6, 9, 11];

    if x == y && x == 2 {
        "Yes"
    } else if f.into_iter().filter(|&i| &x == i).count() == s.into_iter().filter(|&i| &y == i).count() {
        "Yes"
    } else {
        "No"
    }.to_string()
}


let a=[1,3,1,2,1,2,1,1,2,1,2,1],i=readLine()!.characters.split(" ").map{Int(String($0))!-1};print(a[i[0]]==a[i[1]] ?"Yes":"No")


let a=[1,3,1,2,1,2,1,1,2,1,2,1],i=readLine()!.characters.split(" ").map{Int(String($0))!--};print(a[i[0]]==a[i[1]] ?"Yes":"No")


let a=[1,3,1,2,1,2,1,1,2,1,2,1];i=readLine()!.characters.split(" ").map{Int(String($0))!--};print(a[i[0]]==a[i[1]] ?"Yes":"No")


import * as fs from 'fs';

const [x, y]: number[] = fs.readFileSync('/dev/stdin', 'utf8').trim().split(' ').map(Number);

const group1 : number[] =[1,3,5,7,8,10,12];
const group2 : number[] =[4,6,9,11];

if (x===2 || y===2) {
    console.log('No');
} else {

    if (group1.find(g=>g===x)&&group1.find(g=>g===y)) {
        console.log('Yes');
    } else if (group2.find(g=>g===x)&&group2.find(g=>g===y)) {
        console.log('Yes');
    } else {
        console.log('No');
    }
}


const input=require('fs').readFileSync('/dev/stdin', 'utf8').split(/[\s]/);const nin=()=>{const r = input[0];input.shift();return Number(r)};const nrin=(n)=>{const a:number[]=[];rep(n,()=>a.push(nin()));return a};const sin=()=>{const r = input[0];input.shift();return String(r)};const out=(...a)=>{console.log(...a)};const floor=(a)=>{return Math.floor(a)};const abs=(a)=>{return Math.abs(a)};const min=(...a)=>{return Math.min(...a)};const max=(...a)=>{return Math.max(...a)};const rep=(n, callback)=>{for(let i = 0;i < n; i++){callback()}};const strrep=(s, i, v)=>{return s.slice(0, i)+v+s.slice(i+1);};const permutation=({result=[],pre=[],post,n=post.length})=>{if(n>0){post.forEach((_,i)=>{const rest=[...post];const elem=rest.splice(i, 1);permutation({result, pre: [...pre,...elem],post:rest,n:n-1})})}else{result.push(pre)}return result};const sw=(s,a:any[],op:'=='|'>='|'>'|'<='|'<'='==')=>{for(let i=0;i<a.length;i+=2){if(op==='=='){if(s==a[i])return a[i+1]}else if(op==='>='){if(s>=a[i])return a[i+1]}else if(op==='<='){if(s<=a[i])return a[i+1]}else if(op==='>'){if(s>a[i])return a[i+1]}else if(op==='<'){if(s<a[i])return a[i+1]}}return a[a.length-1];};const or=(a,...b)=>{for(let i=0;i<b.length;i++)if(a==b[i])return true;return false};const maxindex=(...a)=>{return a.indexOf(Math.max.apply(null,a))};const asc=(ar:number[])=>{return ar.sort((a,b)=>{return a-b})};const desc=(ar:number[])=>{return ar.sort((a,b)=>{return b-a})};const ceil=a=>{return Math.ceil(a)};const srin=s=>{const a:string[]=[];rep(s,()=>a.push(sin()));return a};let ssinteger=-1;const ssin=()=>{ssinteger++;return input[0][ssinteger]};
const main = ()=>{
  let[a,b]=nrin(2)
  out(a==b||
    (a==4||a==6||a==9||a==11)&&(b==4||b==6||b==9||b==11)||
    (a==1||a==3||a==5||a==7||a==8||a==10||a==12)&&(b==1||b==3||b==5||b==7||b==8||b==10||b==12)?'Yes':'No')
}
main()


const stdin = require('fs').readFileSync('/dev/stdin', 'utf8')

const [x, y] = stdin
  .split('\n')[0]
  .split(' ')
  .map(Number)

const grp = [4, 6, 9, 11]

const res = _ => {
  if (x === 2 || y === 2) {
    return 'No'
  } else if (grp.indexOf(x) > -1) {
    if (grp.indexOf(y) > -1) {
      return 'Yes'
    } else {
      return 'No'
    }
  } else if (grp.indexOf(y) > -1) {
    return 'No'
  } else {
    return 'Yes'
  }
}

console.log(res())


import * as fs from 'fs';

const input = fs.readFileSync("/dev/stdin", "utf8").split(" ");
const x = +input[0];
const y = +input[1];

const B = [4,6,9,11];

const check = (param: number) : 'A'| 'B' | 'C' => {
 if (param == 2) {
     return 'C';
 } else if (param in B) {
     return 'B';
 } else
   return 'A'
}

console.log(check(x) == check(y) ? 'Yes' : 'No');


def main():
    N, S = open(0).read().split()
    pre = S.count("E")
    cur = pre
    for Si in S:
        if pre < cur:
            cur = pre
        if Si == "E":
            pre -= 1
        else:
            pre += 1
    print(pre if pre < cur else cur)
    return

main()


def main():
    N, S = open(0).read().split()
    pre = S.count("E")
    ans = pre
    for Si in S:
        if pre < ans:
            ans = pre
        if Si == "E":
            pre -= 1
        else:
            pre += 1
    print(pre if pre < ans else ans)
    return

main()


def main():
    N, S = open(0).read().split()
    pre = S.count("E")
    cur = pre
    for Si in S:
        if cur < pre:
            pre = cur
        if Si == "E":
            cur -= 1
        else:
            cur += 1
    print(pre if pre < cur else cur)
    return

main()


n=int(input())
S=list(input())
W=[0]*(n+1)
E=[0]*(n+1)
for i in range(n):
  W[i]=W[i-1]+S[i].count("W")
  E[n-i-1]=E[n-i]+S[n-i-1].count("E")
W = W[:n]
E = E[:n]
ans = 10000
for i in range(n):
  ans = min(ans,W[i]+E[i]-1)
print(ans)


n=int(input())
s=input()
l = [0]*n
for i in range(n):
  if s[i] == "E":
    for j in range(i+1,n):
      l[j] += 1
  else:
    for j in range(0,i):
      l[j] += 1
c = max(l)
index = l[c]
ans = s[0:index].count("W") + s[index+1:n].count("E")
print(ans)


def turn(curr, A, B):
  count = 0
  count += A.count('W')
  count += B.count('E')

  return count

N = int(input())
S = list(input())
res = []
for i in range(0, N):
  A = S[:i]
  B = S[i + 1:]
  curr = S[i]
  res.append(turn(curr, A, B))

print(min(res))


import java.util.*;
import static java.lang.System.*;
import java.io.*;

public class Main {
	public static void main(String[] args) {
		FastScanner sc = new FastScanner();
		PrintWriter out = new PrintWriter(System.out);
		int n = sc.nextInt();
		char[] str = sc.next().toCharArray();
		int cnt = 0;
	    for(int i = 1; i < n; i++) {
	    	if (str[i] == 'E') cnt++;
	    }
	    int min = cnt;
	    for(int i = 1; i < n; i++) {
	    	if(str[i - 1] == 'W')
	    		cnt++;
	    	if(str[i] == 'E')
	    		cnt--;
	    	if(cnt < 0)
	    		cnt = 0;
	    	if (min > cnt) min = cnt;
	    }
	    out.println(min);

		out.close();
	}
	  private static long gcd(long m, long n) {
		    if(m < n) return gcd(n, m);
		    if(n == 0) return m;
		    return gcd(n, m % n);
		}

static class FastScanner {
    private final InputStream in = System.in;
    private final byte[] buffer = new byte[1024];
    private int ptr = 0;
    private int buflen = 0;
    private boolean hasNextByte() {
        if (ptr < buflen) {
            return true;
        }else{
            ptr = 0;
            try {
                buflen = in.read(buffer);
            } catch (IOException e) {
                e.printStackTrace();
            }
            if (buflen <= 0) {
                return false;
            }
        }
        return true;
    }
    private int readByte() { if (hasNextByte()) return buffer[ptr++]; else return -1;}
    private static boolean isPrintableChar(int c) { return 33 <= c && c <= 126;}
    public boolean hasNext() { while(hasNextByte() && !isPrintableChar(buffer[ptr])) ptr++; return hasNextByte();}
    public String next() {
        if (!hasNext()) throw new NoSuchElementException();
        StringBuilder sb = new StringBuilder();
        int b = readByte();
        while(isPrintableChar(b)) {
            sb.appendCodePoint(b);
            b = readByte();
        }
        return sb.toString();
    }
    public long nextLong() {
        if (!hasNext()) throw new NoSuchElementException();
        long n = 0;
        boolean minus = false;
        int b = readByte();
        if (b == '-') {
            minus = true;
            b = readByte();
        }
        if (b < '0' || '9' < b) {
            throw new NumberFormatException();
        }
        while(true){
            if ('0' <= b && b <= '9') {
                n *= 10;
                n += b - '0';
            }else if(b == -1 || !isPrintableChar(b)){
                return minus ? -n : n;
            }else{
                throw new NumberFormatException();
            }
            b = readByte();
        }
    }
    public int nextInt() {
        long nl = nextLong();
        if (nl < Integer.MIN_VALUE || nl > Integer.MAX_VALUE) throw new NumberFormatException();
        return (int) nl;
    }
    public double nextDouble() { return Double.parseDouble(next());}
}
}


import java.io.IOException;
import java.io.InputStream;
import java.util.NoSuchElementException;

public class Main {

	public static void main(String[] args) {
		FastScanner sc = new FastScanner();
		int N = sc.nextInt();
		String S = sc.next();

		int count_left = 0;
		int count_right = 0;
		for (int i = 1; i < N; i++) {
			if (S.charAt(i) == 'E')
				count_right++;
		}

		int min = count_right;

		for (int i = 1; i < N; i++) {
			if (S.charAt(i - 1) == 'W')
				count_left++;
			if (S.charAt(i) == 'E')
				count_right--;
			min = Math.min(min, count_left + count_right);
		}
		System.out.println(min);

	}

	//以下、自作ライブラリ

	/*
		int N = sc.nextInt();

		int[] a = new int[N];
		for (int i = 0; i < N; i++)
			a[i] = sc.nextInt();

		String s = sc.next();

		String[] a = new String[N];
		for (int i = 0; i < N; i++)
			a[i] = sc.next();
	 */

	//階乗
	public static int fact(int n) {
		if (n == 1 || n == 0)
			return 1;
		else
			return n * fact(n - 1);
	}

	//指定した値以上の要素が最初に現れる位置
	//要素の数は+1（配列のズレ)
	public static long lowerBound(int n, long[] x, long y) {
		int left = 0;
		int right = n;
		while (left < right) {
			int mid = (left + right) / 2;
			if (x[mid] < y) {
				left = mid + 1;
			} else {
				right = mid;
			}
		}
		return left;
	}

	//指定した値より大きい要素が最初に現れる位置
	//要素の数は+1（配列のズレ)
	public static long upperBound(int n, long[] x, long y) {
		int left = 0;
		int right = n;
		while (left < right) {
			int mid = (left + right) / 2;
			if (x[mid] <= y) {
				left = mid + 1;
			} else {
				right = mid;
			}
		}
		return left;
	}

	//最大公約数
	public static long gcd(long a, long b) {
		if (a < b)
			return gcd(b, a);
		long c = 0;
		c = a % b;
		if (c == 0)
			return b;
		return gcd(b, c);
	}

	//最小公倍数
	public static long lcm(long m, long n) {
		return m * n / gcd(m, n);
	}

	//素数判定
	public static boolean isPrime(int n) {
		if (n < 2)
			return false;
		if (n == 2)
			return true;
		if (n % 2 == 0)
			return false;

		for (int i = 3; i * i <= n; i += 2) {
			if (n % i == 0)
				return false;
		}
		return true;
	}
}

//以下、高速スキャナークラス
class FastScanner {
	private final InputStream in = System.in;
	private final byte[] buffer = new byte[1024];
	private int ptr = 0;
	private int buflen = 0;

	private boolean hasNextByte() {
		if (ptr < buflen) {
			return true;
		} else {
			ptr = 0;
			try {
				buflen = in.read(buffer);
			} catch (IOException e) {
				e.printStackTrace();
			}
			if (buflen <= 0) {
				return false;
			}
		}
		return true;
	}

	private int readByte() {
		if (hasNextByte())
			return buffer[ptr++];
		else
			return -1;
	}

	private static boolean isPrintableChar(int c) {
		return 33 <= c && c <= 126;
	}

	public boolean hasNext() {
		while (hasNextByte() && !isPrintableChar(buffer[ptr]))
			ptr++;
		return hasNextByte();
	}

	public String next() {
		if (!hasNext())
			throw new NoSuchElementException();
		StringBuilder sb = new StringBuilder();
		int b = readByte();
		while (isPrintableChar(b)) {
			sb.appendCodePoint(b);
			b = readByte();
		}
		return sb.toString();
	}

	public long nextLong() {
		if (!hasNext())
			throw new NoSuchElementException();
		long n = 0;
		boolean minus = false;
		int b = readByte();
		if (b == '-') {
			minus = true;
			b = readByte();
		}
		if (b < '0' || '9' < b) {
			throw new NumberFormatException();
		}
		while (true) {
			if ('0' <= b && b <= '9') {
				n *= 10;
				n += b - '0';
			} else if (b == -1 || !isPrintableChar(b)) {
				return minus ? -n : n;
			} else {
				throw new NumberFormatException();
			}
			b = readByte();
		}
	}

	public int nextInt() {
		long nl = nextLong();
		if (nl < Integer.MIN_VALUE || nl > Integer.MAX_VALUE)
			throw new NumberFormatException();
		return (int) nl;
	}

	public double nextDouble() {
		return Double.parseDouble(next());
	}
}


import java.io.IOException;
import java.io.InputStream;
import java.util.HashSet;
import java.util.NoSuchElementException;
import java.util.Set;

public class Main {
	public static void main(String[] args) {
		FastScanner sc = new FastScanner();
		int N = sc.nextInt();
		String S = sc.next();
		char west = 'W';
		char east = 'E';
		int rightEast = 0;
		for (int i = 0; i < N; i++) {
			if (S.charAt(i) == east) rightEast++;
		}
		int leftWest = 0;
		int ans = Integer.MAX_VALUE;
		for (int i = 0; i < N; i++) {
			char t = S.charAt(i);
			if (t == east) {
				rightEast--;
			}
			ans = Math.min(ans, rightEast + leftWest);
			if (t == west) {
				leftWest++;
			}
		}
		out(ans);
	}

	static class Combination {
		final int mod;
		final int max;

		final long[] fact;
		final long[] inv;
		final long[] invfact;

		public Combination(int n) {
			this(n, 1_000_000_007);
		}

		public Combination(int n, int mod) {
			this.mod = mod;
			max = n + 1;
			fact = new long[max];
			invfact = new long[max];
			inv = new long[max];

			inv[1] = 1;
			for (int i = 2; i < inv.length; i++) {
				inv[i] = inv[mod % i] * (mod - mod / i) % mod;
			}

			fact[0] = 1;
			invfact[0] = 1;
			for (int i = 1; i < inv.length; i++) {
				fact[i] = i * fact[i - 1] % mod;
				invfact[i] = inv[i] * invfact[i - 1] % mod;
			}
		}

		public long get(int n, int r) {
			return fact[n] * invfact[n - r] % mod * invfact[r] % mod;
		}
	}

	public static long gcd(long a, long b) {
		long remainder = a % b;
		if (remainder == 0) {
			return b;
		} else {
			return gcd(b, remainder);
		}
	}

	static void out(String a) {
		System.out.println(a);
	}

	static void out(int a) {
		System.out.println(a);
	}

	static void out(long a) {
		System.out.println(a);
	}

	static void out(double a) {
		System.out.println(a);
	}

	static void out(char a) {
		System.out.println(a);
	}
}

class FastScanner {
    private final InputStream in = System.in;
    private final byte[] buffer = new byte[1024];
    private int ptr = 0;
    private int buflen = 0;
    private boolean hasNextByte() {
        if (ptr < buflen) {
            return true;
        } else {
            ptr = 0;
            try {
                buflen = in.read(buffer);
            } catch (IOException e) {
                e.printStackTrace();
            }
            if (buflen <= 0) {
                return false;
            }
        }
        return true;
    }

    private int readByte() {
        if (hasNextByte())
            return buffer[ptr++];
        else
            return -1;
    }

    private static boolean isPrintableChar(int c) {
        return 33 <= c && c <= 126;
    }

    public boolean hasNext() {
        while (hasNextByte() && !isPrintableChar(buffer[ptr]))
            ptr++;
        return hasNextByte();
    }

    public String next() {
        if (!hasNext())
            throw new NoSuchElementException();
        StringBuilder sb = new StringBuilder();
        int b = readByte();
        while (isPrintableChar(b)) {
            sb.appendCodePoint(b);
            b = readByte();
        }
        return sb.toString();
    }

    public long nextLong() {
        if (!hasNext())
            throw new NoSuchElementException();
        long n = 0;
        boolean minus = false;
        int b = readByte();
        if (b == '-') {
            minus = true;
            b = readByte();
        }
        if (b < '0' || '9' < b) {
            throw new NumberFormatException();
        }
        while (true) {
            if ('0' <= b && b <= '9') {
                n *= 10;
                n += b - '0';
            } else if (b == -1 || !isPrintableChar(b)) {
                return minus ? -n : n;
            } else {
                throw new NumberFormatException();
            }
            b = readByte();
        }
    }

    public int nextInt() {
        long nl = nextLong();
        if (nl < Integer.MIN_VALUE || nl > Integer.MAX_VALUE)
            throw new NumberFormatException();
        return (int) nl;
    }

    public double nextDouble() {
        return Double.parseDouble(next());
    }
}


import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        String s = sc.next();
        char[] c = s.toCharArray();
        int min = Integer.MAX_VALUE;
        for (int i = 0; i < n; i++) {
            int sum = 0;
            for (int j = 0; j < n; j++) {
                if (i == j) {
                    continue;
                } else if (i < j) {
                    if (c[j] == 'E') {
                        sum++;
                    }
                } else {
                    if (c[j] == 'W') {
                        sum++;
                    }
                }
            }
            min = Math.min(min, sum);
        }
        System.out.println(min);
    }
}


import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.Scanner;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        Scanner in = new Scanner(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        Attention solver = new Attention();
        solver.solve(1, in, out);
        out.close();
    }

    static class Attention {
        public void solve(int testNumber, Scanner in, PrintWriter out) {
            int n = in.nextInt();
            char[] s = in.next().toCharArray();

            int cost = Integer.MAX_VALUE;
            int wc = 0;
            int ec = 0;

            for (int i = 0; i < n; i++) {
                int wcount = n - i;
                int ecount = i;

                ecount -= ec;

                if (s[i] == 'W') {
                    wc++;
                } else if (s[i] == 'E') {
                    ec++;
                }

                for (int j = i + 1; j < n; j++) {
                    if (s[j] == 'W') {
                        wcount--;
                    } else if (s[j] == 'E') {
                    }
                }
                cost = Math.min(cost, wcount + ecount - 1);
            }
            out.println(cost);
        }

    }
}


import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.Scanner;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        Scanner in = new Scanner(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        Attention solver = new Attention();
        solver.solve(1, in, out);
        out.close();
    }

    static class Attention {
        public void solve(int testNumber, Scanner in, PrintWriter out) {
            int n = in.nextInt();
            char[] s = in.next().toCharArray();

            int cost = Integer.MAX_VALUE;
            for (int i = 0; i < n; i++) {
                int wcount = n - i;
                int ecount = i;
                for (int j = 0; j < n; j++) {
                    if (i == j) {
                        continue;
                    }
                    if (j < i) {
                        if (s[j] == 'W') {

                        } else if (s[j] == 'E') {
                            ecount--;
                        }
                    } else {
                        if (s[j] == 'W') {
                            wcount--;
                        } else if (s[j] == 'E') {

                        }
                    }
                }
                cost = Math.min(cost, wcount + ecount - 1);
            }
            out.println(cost);
        }

    }
}


#include <stdio.h>
#include <stdint.h>
#include <stdbool.h>

#define max(a,b) ((a > b) ? a : b)
#define min(a,b) ((a < b) ? a : b)
#define abs(a) ((a < 0) ? -a : a)

typedef uint8_t u8;
typedef uint16_t u16;
typedef uint32_t u32;
typedef uint64_t u64;
typedef int8_t s8;
typedef int16_t s16;
typedef int32_t s32;
typedef int64_t s64;

static inline int ri() {
	int a;
	scanf("%d", &a);
	return a;
}

int main() {
	int n = ri();
	char s[n+1];
	for (int i = 0; i <= n; i++) s[i] = '\0';
	scanf("%s", s);

	int first = 0;
	for (int i = 1; i < n; i++) {
		if (s[i] == 'E') first++;
	}

	int res = first;
	int cur = first;
	for (int i = 1; i < n; i++) {
		if (s[i-1] == 'W') cur++; // <-
		if (s[i] == 'E') cur--;   // ->
		res = min(res, cur);
	}

	printf("%d", res);

	return 0;
}


#include <cstdio>
#define FOR(i, m, n) for (int i = m; i < n; ++i)
#define REP(i, n) FOR(i, 0, n)
#define MIN(x, y) x < y ? x : y
using namespace std;

int n, t, ans=1<<30;
char s[300005];

int main() {
  scanf("%d", &n), scanf("%s", s);
	FOR(i,1,n) t += (s[i]=='E');
	REP(i,n) {
		ans = MIN(ans, t);
		t += (s[i]=='W') - (s[i+1]=='E');
	}
	printf("%d\n", ans);
	return 0;
}


#include <cstdio>
#define REP(i, n) for (int i = 0; i < n; ++i)
#define MIN(x, y) x < y ? x : y
using namespace std;
const int MAXN = 300005;

int n, e[MAXN], ans=1<<30;
char s[MAXN];

int main() {
    scanf("%d", &n), scanf("%s", s);
    REP(i,n) e[i+1] = e[i] + (s[i] == 'E');
    REP(i,n) ans = MIN(ans, i - e[i] + e[n] - e[i+1]);
    printf("%d", ans);
    return 0;
}


#include <iostream>
#include <vector>
#include <string>
using namespace std;
int main(){
    int N;
    string S;
    cin >> N >> S;
    vector<int> cntl(N + 1);
    for(int i = 0; i < N; i++){
        if(S[i] == 'E') cntl[i + 1] = cntl[i] + 1;
        else cntl[i + 1] = cntl[i];
    }
    int ans = 1e9;
    for(int i = 0; i < N; i++){
        int t = max(0, i - 1) - cntl[i] + (N - i - 1 - (cntl[N] - cntl[i + 1]));
        ans = min(ans, t);
    }
    cout << ans << endl;
}


#include<bits/stdc++.h>
using namespace std;

int main( void )
{
  int N;
  string S;
  int countW, countE;
  int min = INT_MAX;
  cin >> N >> S;

  for( int i = 0; i < N; i++ ) {
    countE = 0;
    countW = 0;

    for( int j = 0; j < i; j++ ) {
      if( S.at( j ) != 'E' )
	countE++;
    }
    for( int j = i + 1; j < N; j++ ) {
      if( S.at( j ) != 'W' )
	countW++;
    }
    if( min > countE + countW )
      min = countE + countW;
  }
  cout << min << endl;
}


#include<bits/stdc++.h>
using namespace std;

int main(){
  int N;
  string str;
  cin>>N>>str;
  vector<int> dataW(N);
  vector<int> dataE(N);
  if(str.at(0)=='W'){dataW.at(0)=1;}else{dataW.at(0)=0;}
  if(str.at(N-1)=='E'){dataE.at(0)=1;}else{dataE.at(0)=0;}
  for(int i=1;i<N;i++){
    if(dataW.at(i)=='W'){
      dataW.at(i)=dataW.at(i-1)+1;
    }else{
      dataW.at(i)=dataW.at(i-1);
    }
    if(dataE.at(N-1-i)=='E'){
      dataE.at(i)=dataE.at(i-1)+1;
    }else{
      dataE.at(i)=dataE.at(i-1);
    }
  }

  int cnt=dataE.at(N-2);
  for(int i=1;i<N-1;i++){
    int tmp=dataW.at(i-1)+dataE.at(N-2-i);
    cnt=min(cnt,tmp);
  }
  cnt=min(cnt,dataE(N-2));
  cout<<cnt<<endl;
}


#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
#define MOD1 1000000007
#define MOD2 998244353
#define LIMIT1 200002
#define LIMIT2 500002
typedef long long ll;
typedef long double ld;
typedef const void cv;
#define rep(i,n) for((i)=0;(i)<(n);(i)++)
#define per(i,n) for((i)=(n)-1;(i)>=0;(i)--)
#define max(a,b) ((a)>(b) ? (a) : (b))
#define min(a,b) ((a)<(b) ? (a) : (b))
#define zt(a,b) (max((a),(b))-min((a),(b)))
#define absl(v) labs((v))
ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
ll nPr(int n,int r){ll i,result=1;rep(i,r){result*=(ll)(n-i);}return result;}
ll nCr(int n,int r){ll i,result=1;if(n<r) return 0;rep(i,min(r,n-r)){result*=(ll)(n-i);result/=(ll)(i+1);}return result;}
#define nHr(n,r) nCr((int)((n)+(r)+1),(int)(r))
#define sankaku(x) (((x)*((x)+1))/2)
int dx[8]={1,0,-1,0,1,-1,-1,1},dy[8]={0,1,0,-1,1,1,-1,-1};
int upint(cv *a, cv *b) { return *(int *)a < *(int *)b ? -1 : *(int *)a > *(int *)b ? 1 : 0; }
int downint(cv *a, cv *b) { return *(int *)a < *(int *)b ? 1 : *(int *)a > *(int *)b ? -1 : 0; }
int upchar(cv *left, cv *right) {return strcmp((char *)left,(char *)right);}
int downchar(cv *left, cv *right) {return strcmp((char *)right,(char *)left);}
void tmpInit(int *c,ll m) {ll i;rep(i,m) c[i]=i;}
ll modpow(ll a, ll n, ll mod) {
    ll res = 1;
    while (n > 0) {
        if (n & 1){
            res *= a; if(mod>=1) res %= mod;
        }
        a *= a; if(mod>=1) a %= mod;
        n >>= 1;
    }
    return res;
}
void initialize(){

}
int main(void){
  initialize();
  ll n,m,i,j,k,result=0,tmp=0,tmp2=0;
  int a[LIMIT2]={0};
  char s[LIMIT2];

  scanf("%lld",&n);
  scanf("%s",s);
  rep(i,n){
    if(s[i]=='E') tmp2++;
  }
  rep(i,n){
    if(s[i]=='E') tmp2--;
    if(i==0) result = tmp+tmp2;
    else result = min(result,tmp+tmp2);
    if(s[i]=='W') tmp++;
  }
  printf("%lld",result);
  return 0;
}


#include <stdio.h>
char s[300000];
int main(){
  int n,i,count=0,count_min;

  scanf("%d",&n);
  scanf("%s",s);

  for(i=1;i<n;i++){
    if(s[i]=='E'){
      count++;
    }
  }
  count_min=count;

  for(i=1;i<n;i++){
    if(s[i-1]=='W'){
      count+=1;
    }
    if(s[i]=='E'){
      count-=1;
    }

    if(count<count_min){
      count_min=count;
    }
  }

  printf("%d",count_min);
}


#include <stdio.h>
char s[300000];
int main() {
    int n, cou = 0, min;
    scanf("%d %s", &n, s);
    for (int i = 0; i < n; i++) {
        if (s[i] == 'E') {
            cou++;
        }
    }
    min = cou;
    for (int i = 0; i < n; i++) {
        if (s[i] == 'E') cou--;
        if (i != 0 && s[i - 1] == 'W') cou++;
        if (cou < min) min = cou;
    }
    printf("%d\n", min);
    return 0;
}


#include <stdio.h>
#include <string.h>
#pragma warning(disable : 4996)

int main()
{
    int i,j;
    long N;
    char s[300010];
    long ans = 150000;
    int sum;

    scanf("%ld", &N);
    scanf("%s", s);

    for (i = 0; i < N; i++) {
        sum = 0;
        for (j = 0; j < i; j++) {
            if (s[j] != 'E')
                sum++;
        }

        if (sum >= ans) break;

        for (j = i + 1; j < N; j++) {
            if (s[j] != 'W')
                sum++;
        }

        if (sum < ans)
            ans = sum;

    }

    printf("%ld", ans);

    return 0;
}


#include <stdio.h>
#include <string.h>
#pragma warning(disable : 4996)

int main()
{
    int N,i,j;
    char s[300010];
    long ans = 300000;
    int sum;

    scanf("%d", &N);
    scanf("%s", s);

    for (i = 0; i < N; i++) {
        sum = 0;
        for (j = 0; j < i; j++) {
            if (s[j] != 'E')
                sum++;
            if (sum >= ans) break;
        }

        for (j = i + 1; j < N; j++) {
            if (s[j] != 'W')
                sum++;
            if (sum >= ans) break;
        }

        if (sum < ans)
            ans = sum;

    }

    printf("%ld", ans);

    return 0;
}


#include <stdio.h>
#include <string.h>
#pragma warning(disable : 4996)

int main()
{
    int N,i,j;
    char s[300010];
    long ans = 300000;
    int sum;

    scanf("%d", &N);
    scanf("%s", s);

    for (i = 0; i < N; i++) {
        sum = 0;
        for (j = 0; j < i; j++) {
            if (s[j] != 'E')
                sum++;
        }
        for (j = i + 1; j < N; j++) {
            if (s[j] != 'W')
                sum++;
        }
        if (sum < ans)
            ans = sum;

    }

    printf("%ld", ans);

    return 0;
}


function main(input) {
  input = input.split('\n');
  var n = Number(input[0]);
  var seq = input[1];
  var change = 0;
  for (var i = 1; i < n; i++) {
    if (seq[i] === 'E') change += 1;
  }
  var minChange = change;
  var prev = seq[0];
  for (i = 1; i < n; i++) {
    if (prev === 'W') {
      change += 1;
    }
    if (seq[i] === 'E') {
      change -= 1;
    }
    minChange = Math.min(change, minChange);
    prev = seq[i];
  }
  console.log(minChange);
}

main(require('fs').readFileSync('/dev/stdin', 'utf8'));


"use strict";

var main = function main(input) {
  var N = parseInt(input.split('\n')[0], 10);
  var S = input.split('\n')[1].split('');
  var init = 0;

  for (var i = 0; i < N; i++) {
    if (S[i] == 'E' && i != 0) {
      init++;
    }
  }

  var tmp = init;
  var min = init;

  for (var _i = 1; _i < N; _i++) {
    if (S[_i] == 'E' && S[_i - 1] == 'E') {
      tmp--;
    } else if (S[_i] == 'W' && S[_i - 1] == 'W') {
      tmp++;
    }

    if (tmp < min) {
      min = tmp;
    }
  }

  console.log(min);
};

main(require('fs').readFileSync('/dev/stdin', 'utf-8'));


function main(input){
  const lines = input.split('\n');

  const N = parseInt(lines[0]);
  const S = lines[1].split('');

  var result = Math.pow(10, 8);
  var current_count = 0;
  for(var i=1;i<N;i++){
    if(S[i]=='E'){current_count++;}
  }
  result = current_count;

//    console.log(current_count);
  for(var i=1;i<N;i++){
    if(S[i]=='E'){current_count--;}
    if(S[i-1]=='W'){current_count++;}
    result = Math.min(result, current_count);
//    console.log(current_count);
  }
//    console.log('---');

  console.log(result);
}

main(require('fs').readFileSync('/dev/stdin', 'utf8'));


'use strict';
function Main(stdin){
  const input = stdin.trim().split(/\r?\n/g);
  const N = Number(input[0]);
  const S = input[1].split('');
  let min_count = N;
  for(let i = 0; i < N; i++){
      let count = 0;
      for(let j = 0; j < N; j++){
          if(j < i){
              if(S[j] === 'W') count++;
          } else if (i < j){
              if(S[j] === 'E') count++;
          }
          if(min_count < count) break;
      }
      if(count < min_count) min_count = count;
  }
  console.log(min_count);
}

// 固定
Main(require("fs").readFileSync("/dev/stdin", "utf8"));


function* stdinIter() {
    var stdin = require('fs').readFileSync('/dev/stdin', 'utf-8').trim().split(/\n|\s/)
    yield* stdin
}

let _iter
function readMany(n, iter) {
    _iter = iter || _iter || stdinIter()
    var res = []
    for (let i = 0; i < n; i += 1) res.push(_iter.next().value)
    return res
}

(() => {
  	'use strict'
    const [ n, s ] = readMany(2)

    const west = []
    for (let i = 0; i < n; i += 1) {
        const before = west[i - 1] || 0
        if (s[i] == 'W') {
            west.push(before + 1)
        } else {
            west.push(before)
        }
    }

    const leader = []
    for (let i = 0; i < n; i += 1) {
        const people = (west[i - 1] || 0) + ((n - i - 1) - (west[n - 1] - west[i]))
        leader.push(people)
    }

    let ans = Infinity
    for (let i = 0; i < n; i += 1) {
        if (leader[i] < ans) ans = leader[i]
    }

    console.log(ans)
})()


"use strict";

const main = arg => {
    arg = arg.trim().split("\n");
    const N = parseInt(arg[0]);
    const S = arg[1].split("");

    // リーダーより右は全員Wになる
    // 左は全員Eになるべき

    let W = 0;
    let E = S.filter(n=>n === "E").length;

    if(E === N || E === 0) {
        console.log(0);
        return;
    }

    let answer = Infinity;

    for(let i=0; i<N; i++) {
        let toE = 0;
        let toW = 0;

        if(E > 0) {
            toW = E;
        }

        if(W > 0) {
            toE = W;
        }

        const temp = toE + toW;
        answer = Math.min(answer, temp);

        if(S[i] === "W") {
            W++;
        } else {
            E--;
        }

    }

    console.log(answer);
}
main(require('fs').readFileSync('/dev/stdin', 'utf8'));


package main

import (
	"bufio"
	"fmt"
	"os"
	"strconv"
)

func main() {
	var sc = bufio.NewScanner(os.Stdin)
	maxSize := 300000 * 2
	buf := make([]byte, maxSize)
	sc.Buffer(buf, maxSize)
	n := scanLineInt(sc)
	s := scanLineStr(sc)

	var count int
	for i := 0; i < n; i++ {
		if s[i] == 'E' {
			count++
		}
	}

	min := count
	for i := 0; i < n; i++ {
		if s[i] == 'E' {
			count--
		}
		if i > 0 && s[i-1] == 'W' {
			count++
		}
		if count < min {
			min = count
		}
	}
	fmt.Println(min)
}

func scanLineStr(sc *bufio.Scanner) string {
	sc.Scan()
	return sc.Text()
}

func scanLineInt(sc *bufio.Scanner) int {
	sc.Scan()
	i, e := strconv.Atoi(sc.Text())
	if e != nil {
		panic(e)
	}
	return i
}


package main

import (
	"bufio"
	"fmt"
	"os"
	"strconv"
)

func main() {
	var sc = bufio.NewScanner(os.Stdin)
	maxSize := 300000 * 2
	buf := make([]byte, maxSize)
	sc.Buffer(buf, maxSize)
	n := scanLineInt(sc)
	s := scanLineStr(sc)

	var count int
	for i := 0; i < n; i++ {
		if s[i] == 'E' {
			count++
		}
	}

	result := count
	for i := 0; i < n; i++ {
		if s[i] == 'E' {
			count--
		}
		if i > 0 && s[i-1] == 'W' {
			count++
		}
		result = min(result, count)
	}
	fmt.Println(result)
}

func scanLineStr(sc *bufio.Scanner) string {
	sc.Scan()
	return sc.Text()
}

func scanLineInt(sc *bufio.Scanner) int {
	sc.Scan()
	i, _ := strconv.Atoi(sc.Text())
	return i
}

func min(a, b int) int {
	if a < b {
		return a
	}
	return b
}


package main

import (
	"bufio"
	"fmt"
	"os"
	"strconv"
)

func main() {
	var sc = bufio.NewScanner(os.Stdin)
	maxSize := 300000 * 2
	buf := make([]byte, maxSize)
	sc.Buffer(buf, maxSize)
	sc.Scan()
	s := scanLineStr(sc)

	count := 0
	for i := range s {
		if s[i] == 'E' {
			count++
		}
	}

	result := count
	for i := range s {
		if s[i] == 'E' {
			count--
		}
		if i > 0 && s[i-1] == 'W' {
			count++
		}
		result = min(result, count)
	}
	fmt.Println(result)
}

func scanLineStr(sc *bufio.Scanner) string {
	sc.Scan()
	return sc.Text()
}

func scanLineInt(sc *bufio.Scanner) int {
	sc.Scan()
	i, _ := strconv.Atoi(sc.Text())
	return i
}

func min(a, b int) int {
	if a < b {
		return a
	}
	return b
}


package main

import (
	"bufio"
	"fmt"
	"os"
)

var rdr = bufio.NewReaderSize(os.Stdin, 10000000)

func readLine() string {
	buf := make([]byte, 0, 10000000)
	for {
		l, p, e := rdr.ReadLine()
		if e != nil {
			panic(e)
		}
		buf = append(buf, l...)
		if !p {
			break
		}
	}
	return string(buf)
}

func main() {
	_, S := readLine(), readLine()

	fmt.Printf("%d\n", ABC098C(S))
}

// ABC098C ...
func ABC098C(S string) int {
  	w, e := []int{0}, []int{0}

	for i := 1; i < len(S); i++ {
		if S[i-1] == 'W' {
			w = append(w, w[i-1]+1)
		} else {
			w = append(w, w[i-1])
		}
	}

	for i := len(S) - 2; i >= 0; i-- {
		if S[i+1] == 'E' {
			e = append([]int{e[0] + 1}, e...)
		} else {
			e = append([]int{e[0]}, e...)
		}
	}

	res := len(S)
	for leader := 0; leader < len(S); leader++ {
		tmp := w[leader] + e[leader]
		if tmp < res {
			res = tmp
		}
	}

	return res
}


package main

import (
	"bufio"
	"fmt"
	"os"
)

var rdr = bufio.NewReaderSize(os.Stdin, 1000000)

func readLine() string {
	buf := make([]byte, 0, 1000000)
	for {
		l, p, e := rdr.ReadLine()
		if e != nil {
			panic(e)
		}
		buf = append(buf, l...)
		if !p {
			break
		}
	}
	return string(buf)
}

func main() {
	_, S := readLine(), readLine()

	fmt.Printf("%d\n", ABC098C(S))
}

// ABC098C ...
func ABC098C(S string) int {
	l, r := 0, 0
	for i := 0; i < len(S); i++ {
		if S[i] == 'E' {
			r++
		}
	}
	res := l + r

	for leader := 1; leader < len(S); leader++ {
		if S[leader-1] == 'W' {
			l++
		}
		if S[leader] == 'E' {
			r--
		}
		if l+r < res {
			res = l + r
		}
	}

	return res
}


package main

import (
	"bufio"
	"fmt"
	"os"
	"strconv"
)

var sc = bufio.NewScanner((os.Stdin))

func nextLine() string {
	sc.Scan()
	return sc.Text()
}

func nextInt() int {
	l := nextLine()
	i, e := strconv.Atoi(l)
	if e != nil {
		panic(e)
	}
	return i
}

func main() {
	sc.Split(bufio.ScanWords)
	N, S := nextInt(), nextLine()

	fmt.Printf("%d\n", ABC098C(N, S))
}

// ABC098C ...
func ABC098C(N int, S string) int {
	res := N

	for leader := 0; leader < N; leader++ {
		tmp := 0
		for j := 0; j < N; j++ {
			if leader < j && S[j] == 'E' {
				tmp++
			} else if j < leader && S[j] == 'W' {
				tmp++
			}
		}
		if tmp < res {
			res = tmp
		}
	}

	return res
}


n = gets.to_i
s = gets.chomp
count = 3000000

left_count = 0 # 先頭から
right_count = s.count('E') # 最初は向く方向が代わるEをカウント

n.times do |i|
  if s[i] == 'W'
    ans = left_count + right_count
    left_count += 1
  else
    right_count -= 1
    ans = left_count + right_count
  end
  count = ans if ans < count
end

puts count


n = gets.chomp.to_i
x = gets.chomp

left = 0
right = x.count("E")
ans = n

n.times do |i|
  s = 0
  curr = x[i]
  if curr == "W"
    s = left + right
    left += 1
  else
    right -= 1
    s = left + right
  end
  ans = s if s < ans
end
puts ans


n = gets.to_i
s = gets.chomp
tmp = 0
cum = [0]
min = 3 * 10**5 - 1

s.each_char do |c|
  tmp += 1 if c == 'W'
  cum << tmp
end

1.upto(n) do |i|
  tmp = cum[i - 1] + n - i - (cum[-1] - cum[i])
  min = tmp if min > tmp
end

puts min


n = gets.to_i
s = gets.chomp.split('').map &:to_s

$w_rui = [0]
$e_rui = [0]
(1..n).each do |i|
  $w_rui.push s[i] === 'W' ? $w_rui[-1] + 1 : $w_rui[-1]
  $e_rui.unshift s[n-i] === 'E' ? $e_rui[0] + 1 : $e_rui[0]
end

puts [$w_rui , $e_rui].transpose.map{|x| x.sum}.min


n = gets.to_i
pontas = gets.chomp.chars

count_e = pontas.count('E')

costs = (1...n).each_with_object([[count_e, 0]]) { |i, result|
  result <<
      [
        pontas[i] == 'E' ? result.last.first - 1 : result.last.first,
        pontas[i - 1] == 'W' ? result.last.last + 1 : result.last.last
      ]
}

puts costs.map { |left_cost, right_cost| left_cost + right_cost }.min


n = gets.to_i
pontas = gets.chomp.chars

count_e = pontas.count('E')

costs = (1...n).each_with_object([[count_e, 0]]) { |i, result|
  result <<
      [
        pontas[i] == 'E' ? result.last.first - 1 : result.last.first,
        pontas[i - 1] == 'W' ? result.last.last + 1 : result.last.last
      ]
}

puts costs.map(&:sum).min


#![allow(non_snake_case)]

use std::io;
use std::cmp::min;

fn main() {
    let mut line = String::new();
    io::stdin().read_line(&mut line).unwrap();
    line.clear();
    io::stdin().read_line(&mut line).unwrap();
    let S: Vec<char> = line.chars().collect();

    let mut cnt = 0;
    for i in 1..S.len() {
        if S[i] == 'E' {
            cnt += 1;
        }
    }
    let mut ret = cnt;
    for i in 1..S.len() - 1 {
        if S[i - 1] == 'W' {
            cnt += 1;
        }
        if S[i] == 'E' {
            cnt -= 1;
        }
        ret = min(ret, cnt);
    }

    println!("{}", ret);
}


#[macro_use]
mod input {

use std;
use std::io;

const SPLIT_DELIMITER: char = ' ';

#[macro_export]
#[allow(unused_macros)]
macro_rules! input {
    ( $($x:expr ),*) => {
        {
            let temp_str = input_line_str();
            let mut split_result_iter = temp_str.split_whitespace();
                $(
                let buf_split_result = split_result_iter.next();
                let buf_split_result = buf_split_result.unwrap();
                    ($x) = buf_split_result.parse().unwrap();
                )*
        }
    };
}

#[allow(dead_code)]
pub fn input_line_str() -> String {
    let mut s = String::new();
    io::stdin().read_line(&mut s).unwrap();
    s.trim().to_string()
}

#[allow(dead_code)]
pub fn p<T>(t: T)
where
    T: std::fmt::Display,
{
    println!("{}", t);
}

#[allow(dead_code)]
pub fn input_vector2d<T>(line: usize) -> Vec<Vec<T>>
where
    T: std::str::FromStr,
{
    let mut v: Vec<Vec<T>> = Vec::new();

    for _ in 0..line {
        let vec_line = input_vector();
        v.push(vec_line);
    }
    v
}

#[allow(dead_code)]
pub fn input_vector<T>() -> Vec<T>
where
    T: std::str::FromStr,
{
    let mut v: Vec<T> = Vec::new();

    let s = input_line_str();
    let split_result = s.split(SPLIT_DELIMITER);
    for z in split_result {
        let buf = match z.parse() {
            Ok(r) => r,
            Err(_) => panic!("Parse Error"),
        };
        v.push(buf);
    }
    v
}

#[allow(dead_code)]
pub fn str2vec(s: &str) -> Vec<char> {
    let mut v: Vec<char> = Vec::new();
    for c in s.chars() {
        v.push(c);
    }
    v
}
}

use input::*;

fn main() {
    let n: usize;
    input!(n);
    let s = str2vec(&input_line_str());
    let mut ecount_right = 0;
    let mut wcount_left = 0;
    for z in &s {
        if *z == 'E' {
            ecount_right += 1;
        }
    }

    let mut ans = 999999;

    for z in 0..n+1 {
        ans = std::cmp::min(wcount_left + ecount_right, ans);

        if z == n{
            break;
        }
        if s[z] == 'W' {
            wcount_left += 1;
        } else {
            ecount_right -= 1;
        }
    }
    p(ans);
}


use std::iter::once;

fn solve(n: usize, s: String) -> i32 {
    let v = once(0)
        .chain(
            s.chars()
                .scan(0, |s, c| {
                    *s = *s + if c == 'E' { 1 }  else { 0 };
                    Some(*s)
                }
            )
        )
        .collect::<Vec<usize>>();
    (0..(n+1))
        .map(|i| i - v[i] + v[n] - v[i])
        .min()
        .map(|i| i as i32)
        .unwrap()
}

fn main() {
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).ok();
    let n = s.trim().parse().ok().unwrap();
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).ok();
    s = s.trim().to_string();
    let res = solve(n, s);
    println!("{}", res);
}


#![allow(unused_imports)]

use proconio::{input, fastout};
use proconio::marker::*;
use nalgebra::min;

#[fastout]
fn main() {
    input! {
    n: usize,
    s: Chars
    }
    let mut l = vec![vec![0; 2]; n + 2];
    for i in 0..n {
        l[i + 1][0] = l[i][0];
        l[i + 1][1] = l[i][1];
        l[i + 1][if s[i] == 'W' { 0 } else { 1 }] += 1;
    }
    l[n + 1] = l[n].clone();
    let mut ans = std::usize::MAX;
    for i in 0..n {
        ans = min(ans, l[i][0] + l[n + 1][1] - l[i][1]);
    }
    println!("{}", ans);
}


#![allow(non_snake_case)]
#![allow(unused_imports)]
#![allow(dead_code)]

use proconio::{input, fastout};
use proconio::marker::*;
use whiteread::parse_line;
use std::collections::*;
use num::*;
use num_traits::*;
use superslice::*;
use std::ops::*;

use itertools::Itertools;
use itertools_num::ItertoolsNum;

#[fastout]
fn solve() {
    const MOD: usize = 1_000_000_007;
    const INF: usize = std::usize::MAX;

    input!{
        n: usize,
        s: Chars,
    }

    let mut cnt_vec: Vec<(usize, usize)> = vec![(0, 0)];

    for i in 0..n {
        let (e, w) = cnt_vec.last().unwrap();
        if s[i] == 'W' {
            cnt_vec.push((*e, *w+1))
        } else {
            cnt_vec.push((*e+1, *w));
        }
    }

    let mut ans = INF;

    for i in 0..n {
        let t = cnt_vec[i].1 + cnt_vec[cnt_vec.len()-1].0 - cnt_vec[i].0;
        ans = std::cmp::min(ans, t);
    }

    println!("{}", ans);
}

fn main() {
    solve()
}

#[cfg(test)]
mod test {
    use super::solve;
}


use proconio::{input, fastout};
use proconio::marker::{Chars};
use proconio::marker::Usize1;
use std::cmp::*;

macro_rules! debug {
      ($($a:expr),*) => {
          eprintln!(concat!($(stringify!($a), " = {:?}, "),*), $($a),*);
      }
  }

#[fastout]
fn main() {
    input!{
        n: usize,
        s: Chars,
    }

    let mut face = 0;
    for i in 0..n {
        if s[i]=='W' {
            face += 1;
        }
    }

    let mut ans = 0;
    if s[0]=='W' {
        face -= 1;
    }
    ans = face;
    for i in 1..n {
        if s[i-1]=='W' && face!=0{
            face -= 1;
        } else {
            face += 1;
        }
        ans = max(ans, face);
        debug!(face);
    }

    println!("{}", n-ans-1);

}


// 🐋💭
import Foundation

func readInts() -> [Int] {
    return readLine()!.split(separator: " ").map { Int($0)! }
}

func readInt() -> Int {
    return Int(readLine()!)!
}

func readDoubles () -> [Double] {
    return readLine()!.split(separator: " ").map { Double($0)! }
}

func readDouble() -> Double{
    return Double(readLine()!)!
}
///最大公約数を返す
func gcd(_ m:Int, _ n:Int) -> Int {
    if n == 0 {return m}
    return gcd(n, m % n)
}

///最大公約数を返す
func gcd(_ array: [Int]) -> Int {
    var value = array[0]
    if array.count > 1 {
        for i in 1..<array.count {
            value = gcd(value, array[i])
        }
    }
    return value
}

///最小公倍数を返す
func lcm(_ m:Int, _ n:Int) -> Int {
    return m * n / gcd(m, n)
}

///素数判定(試し割り)
func isPrime(_ x:Int) -> Bool {
    if x <= 1 || x % 2 == 0 { return false }
    if x == 2 { return true }
    for i in stride(from: 3, to: Int(ceil(sqrt(Double(x)))), by: 2){
        if x % i == 0 {
            return false
        }
    }
    return true
}

//https://program-life.com/669
///実行速度の計測
func exectionTime(action: () -> Void) {
    let startDate = Date()
    action()
    let endDate = Date()
    print(endDate.timeIntervalSince(startDate))
}

// https://melheaven.hatenadiary.jp/entry/atcoder144
///約数の配列を返す
func makeDivisors(_ n:Int) -> [Int] {
    var divisors = [Int]()
    for i in 1..<Int(pow(Double(n), 0.5)) + 1 {
        if n % i == 0{
            divisors.append(i + n / i)
        }
    }

    return divisors
}

//https://riptutorial.com/ja/swift/example/14738/インデックスを知らずに配列から要素を削除する
extension Array where Element: Equatable {

    mutating func remove(_ element: Element) {
        _ = firstIndex(of: element).flatMap {
            self.remove(at: $0)
        }
    }
}

func binarySearch(rifgt:Int, key:Int, ary:[String]) -> Int{
    var left = 0
    var right = rifgt

    while abs(right - left) > 1 {
        let mid = left + (right - left) / 2

        if Int(ary[mid])! < key {
            left = mid

        } else {
            right = mid
        }
    }
    return left
}

func arrangement (prev:String, ary:[String], returnVal:[String]) -> [String] {
    var returnVal = returnVal
    if ary.count == 0 {
        returnVal.append(prev)
        return returnVal
    }

    for s in ary {
        let wprev = prev + s
        var wary = ary
        wary.remove(s)
        returnVal = arrangement(prev: wprev, ary: wary, returnVal: returnVal)
    }
    return returnVal
}

func main() {
    let n = readInt()
    let aryS = readLine()!.map { String($0) }
    //＿＿＿＿＿＿＿＿＿＿＿＿＿＿ここまで入力
    var countLeft = 0
    var countRight = 0
    for i in 1..<n {
        if aryS[i] == "E" {
            countRight += 1
        }
    }
    var ans = countLeft + countRight
    // i = リーダのindex
    for i in 1..<n {
        if aryS[i - 1] == "W" {
            countLeft += 1
        }
        if aryS[i] == "E" {
            countRight -= 1
        }
        ans = min(ans, countLeft + countRight)
    }
    print(ans)
}
main()


let N = Int(readLine()!)!
let S = readLine()!.characters.map{$0}
var a = (1..<N).reduce(0){$0+(S[$1]<"W" ?1:0)}
var ans = a
for i in 1..<N {
    a += (S[i-1]>"E" ?1:0)-(S[i]<"W" ?1:0)
    ans = min(a, ans)
}
print(ans)


let N = Int(readLine()!)!
let S = readLine()!.characters
var e = 0
var w = S.reduce(0){$0+($1<"W" ?1:0)}
var ans = w
for c in S {
    c<"W" ?(w-=1):(e+=1)
    ans = min(e+w,ans)
}
print(ans)


// 🐋💭
import Foundation

func readInts() -> [Int] {
    return readLine()!.split(separator: " ").map { Int($0)! }
}

func readInt() -> Int {
    return Int(readLine()!)!
}

func readDoubles () -> [Double] {
    return readLine()!.split(separator: " ").map { Double($0)! }
}

func readDouble() -> Double{
    return Double(readLine()!)!
}
///最大公約数を返す
func gcd(_ m:Int, _ n:Int) -> Int {
    if n == 0 {return m}
    return gcd(n, m % n)
}

///最大公約数を返す
func gcd(_ array: [Int]) -> Int {
    var value = array[0]
    if array.count > 1 {
        for i in 1..<array.count {
            value = gcd(value, array[i])
        }
    }
    return value
}

///最小公倍数を返す
func lcm(_ m:Int, _ n:Int) -> Int {
    return m * n / gcd(m, n)
}

///素数判定(試し割り)
func isPrime(_ x:Int) -> Bool {
    if x <= 1 || x % 2 == 0 { return false }
    if x == 2 { return true }
    for i in stride(from: 3, to: Int(ceil(sqrt(Double(x)))), by: 2){
        if x % i == 0 {
            return false
        }
    }
    return true
}

//https://program-life.com/669
///実行速度の計測
func exectionTime(action: () -> Void) {
    let startDate = Date()
    action()
    let endDate = Date()
    print(endDate.timeIntervalSince(startDate))
}

// https://melheaven.hatenadiary.jp/entry/atcoder144
///約数の配列を返す
func makeDivisors(_ n:Int) -> [Int] {
    var divisors = [Int]()
    for i in 1..<Int(pow(Double(n), 0.5)) + 1 {
        if n % i == 0{
            divisors.append(i + n / i)
        }
    }

    return divisors
}

//https://riptutorial.com/ja/swift/example/14738/インデックスを知らずに配列から要素を削除する
extension Array where Element: Equatable {

    mutating func remove(_ element: Element) {
        _ = firstIndex(of: element).flatMap {
            self.remove(at: $0)
        }
    }
}

func binarySearch(rifgt:Int, key:Int, ary:[String]) -> Int{
    var left = 0
    var right = rifgt

    while abs(right - left) > 1 {
        let mid = left + (right - left) / 2

        if Int(ary[mid])! < key {
            left = mid

        } else {
            right = mid
        }
    }
    return left
}

func arrangement (prev:String, ary:[String], returnVal:[String]) -> [String] {
    var returnVal = returnVal
    if ary.count == 0 {
        returnVal.append(prev)
        return returnVal
    }

    for s in ary {
        let wprev = prev + s
        var wary = ary
        wary.remove(s)
        returnVal = arrangement(prev: wprev, ary: wary, returnVal: returnVal)
    }
    return returnVal
}

func main() {
    let n = readInt()
    let aryS = readLine()!.map { String($0) }
    //＿＿＿＿＿＿＿＿＿＿＿＿＿＿ここまで入力
    var ans = Int.max
    for i in 0..<n {
        var count = 0
        for j in 0..<i {
            if aryS[j] == "W" {
                count += 1
            }
        }
        for k in i+1..<n {
            if aryS[k] == "E" {
                count += 1
            }
        }
        ans = min(ans, count)
        if ans == 0 {
            break
        }
    }
    print(ans)
}
main()


readLine()
let S=readLine()!.characters
var a=S.reduce(0){$0+($1<"W" ?1:0)}
print(S.map{$0>"E" ? ++a:--a}.minElement()!)


let N = Int(readLine()!)!
let S = readLine()!.characters
var e = 0
var w = S.reduce(0){$0+($1<"W" ?1:0)}
var ans = e
for c in S {
    c<"W" ?(w-=1):(e+=1)
    ans = min(e+w,ans)
}
print(ans)


'use strict'

function main(input) {
  input = input.trim().split('\n')
  const n = Number(input[0])
  const trooper = input[1].split('')

  const countW = [0]
  for (let i = 0; i < n; i++) {
    if (trooper[i] === 'W') countW.push(countW[i] + 1)
    else countW.push(countW[i])
  }
  // countW.shift()

  let min = Number.MAX_SAFE_INTEGER
  for (let i = 0; i < n; i++) {
    let tmp = 0

    // WからEになる人
    tmp += countW[i]

    // console.log(countW[i])
    // EからWになる人
    tmp += n - (i + 1) - countW[n] + countW[i + 1]
    // console.log(n - countW[n] - countW[i])

    min = Math.min(tmp, min)
  }

  console.log(min)
  // console.log(trooper)
}
main(require('fs').readFileSync('/dev/stdin', 'utf8'))


{
  const run = (input: string) => {
    let split = input.trim().split("\n")
    const n = parseInt(split[0].trim())
    const w = split[1].trim()

    let count = -1
    let right = w.split("")

    let leftTurnCount = 0
    let rightTurnCount = 0
    right.forEach((v,i) => {
      if (i !== 0 && v === 'E') rightTurnCount++
    })

    for (let i = 0; i < n; i++) {
      const sum = leftTurnCount + rightTurnCount
      if (count < 0 || sum < count) {
        count = sum
      }
      if (right[i] === 'W') {
        leftTurnCount++;
      }
      if (right[i + 1] === 'E') {
        rightTurnCount--;
      }
    }

    return count
  }

  const Main = (input: string) => {
    console.log(run(input))
  };

  Main(require("fs").readFileSync("/dev/stdin", "utf8"));
}


function Main(input: string) {
  const lines = input.split('\n');
  const params1 = lines[0].split(' ');
  const params2 = lines[1].split(' ');

  const n = parseInt(params1[0]);
  const s = params2[0];

  let cnts: number[] = [s.slice(1).split('').filter(x => x === 'E').length];
  for (let i = 1; i < n; i++) {
    let tmp = cnts[i - 1];
    const prev = s[i - 1];
    const cur = s[i];
    if (prev === 'W') tmp++;
    if (cur === 'E') tmp--;
    cnts.push(tmp);
  }

  const min = cnts.reduce((m, n) => Math.min(m, n));

  console.log(min);
}

Main(require('fs').readFileSync('/dev/stdin', 'utf8'));


{
  const run = (input: string) => {
    let split = input.trim().split("\n")
    const n = parseInt(split[0].trim())
    const w = split[1].trim()

    let count = -1
    let right = w.split("")

    let leftTurnCount = 0
    let rightTurnCount = 0
    right.forEach((v,i) => {
      if (i !== 0 && v === 'E') rightTurnCount++
    })

    for (let i = 0; i < n; i++) {
      const value = right[i]

      const sum = leftTurnCount + rightTurnCount
      if (count < 0 || sum < count) {
        count = sum
      }

      if (value === 'E') {
        if (i === 0) continue

        rightTurnCount--;
      } else if (value === 'W') {
        leftTurnCount++;
      }
    }

    return count
  }

  const Main = (input: string) => {
    console.log(run(input))
  };

  Main(require("fs").readFileSync("/dev/stdin", "utf8"));
}


{
  const run = (input: string) => {
    let split = input.trim().split("\n")
    const n = parseInt(split[0].trim())
    const w = split[1].trim()

    let count = -1
    let right = w.split("")

    let leftTurnCount = 0
    let rightTurnCount = 0
    right.forEach((v,i) => {
      if (i !== 0 && v === 'E') rightTurnCount++
    })

    for (let i = 0; i < n; i++) {
      const value = right[i]

      const sum = leftTurnCount + rightTurnCount
      if (count < 0 || sum < count) {
        count = sum
      }

      if (i === 0) continue

      if (value === 'E') {
        rightTurnCount--;
      } else if (value === 'W') {
        leftTurnCount++;
      }
    }

    return count
  }

  const Main = (input: string) => {
    console.log(run(input))
  };

  Main(require("fs").readFileSync("/dev/stdin", "utf8"));
}


{
  const run = (input: string) => {
    let split = input.trim().split("\n")
    const n = parseInt(split[0].trim())
    const w = split[1].trim()

    let count = -1
    let right = w.split("")

    let leftTurnCount = 0
    let rightTurnCount = 0
    right.forEach((v,i) => {
      if (i !== 1 && v === 'E') rightTurnCount++
    })

    for (let i = 0; i < n; i++) {
      const value = right[i]

      const sum = leftTurnCount + rightTurnCount
      if (count < 0 || sum < count) {
        count = sum
      }

      if (i === 0) continue

      if (value === 'E') {
        rightTurnCount--;
      } else if (value === 'W') {
        leftTurnCount++;
      }
    }

    return count
  }

  const Main = (input: string) => {
    console.log(run(input))
  };

  Main(require("fs").readFileSync("/dev/stdin", "utf8"));
}


N = int(input())
Ans = ""
while N>0:
    s = N%26
    if s == 0:
        s = 26
    N = int((N - s)/26)
    Ans = chr(ord("a")+s-1)+Ans

print(Ans)


def main():
    n = int(input())
    n -= 1

    s = []
    for _ in range(15):
        # print(n)
        s.append(chr(ord('a')+(n%26)))
        n = int(n / 26)
        if n==0:
            break
        n -= 1
    s.reverse()
    print(''.join(s))

    pass

main()


import sys
input = sys.stdin.readline

def log(*args):
    print(*args, file=sys.stderr)

def main():
    n = int(input().strip())
    ans = ''
    while n != 0:
        if n % 26 == 0:
            ans = 'z' + ans
            n -= 26
            n = n // 26
        else:
            ans = chr(n % 26 + ord('a') - 1) + ans
            n = n // 26
    print(ans)

if __name__ == '__main__':
    main()


n=int(input())
data=['a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z']
ans=[]
res=n
while res>0:
  m=res%26
  res=res//26
  if m==0:
    ans.append('z')
  else:
    ans.append(data[m-1])
ans.reverse()
print(*ans,sep='')


n=int(input())
data=['a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z']
ans=[]
res=n
while res>26:
  m=res%26
  res=res//26
  if m==0:
    ans.append('z')
  else:
    ans.append(data[m-1])
ans.append(data[res-1])
ans.reverse()
print(*ans,sep='')


n=int(input())
data=['a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z']
ans=[]
res=n
while res>26:
  m=res%26
  res=res//26
  ans.append(data[m-1])
ans.append(data[res-1])
ans.reverse()
print(*ans,sep='')


import java.util.*;
import java.io.*;
public class Main{

    public static void main(String [] args) throws IOException{
        FastScanner sc=new FastScanner();
        long n=sc.nextLong();
        StringBuilder sb=new StringBuilder("");
        while(n>0){
            n-=1;
            long rm=n%26;
            sb.append((char)('a'+rm));
            n=n/26;
        }
        sb.reverse();
        System.out.println(sb.toString().trim());

    }

}

class FastScanner{
    private int BUFFER_SIZE = 1 << 16;

   private  DataInputStream din;

   private  byte[] buffer;

   private int bufferPointer, bytesRead;

   public FastScanner() {
       din = new DataInputStream(System.in);
       buffer = new byte[BUFFER_SIZE];
       bufferPointer = bytesRead = 0;
   }

   public FastScanner( String file_name) throws IOException {
       din = new DataInputStream(new FileInputStream(file_name));
       buffer = new byte[BUFFER_SIZE];
       bufferPointer = bytesRead = 0;
   }

   public String readLine() throws IOException {
        byte[] buf = new byte[64];
       int cnt = 0, c;
       while ((c = read()) != -1) {
           if (c == '\n')
               break;
           buf[cnt++] = (byte) c;
       }
       return new String(buf, 0, cnt);
   }

   public String next() throws IOException{

       byte c = read();
       while(Character.isWhitespace(c)){
           c = read();
       }

        StringBuilder builder = new StringBuilder();
       builder.append((char)c);
       c = read();
       while(!Character.isWhitespace(c)){
           builder.append((char)c);
           c = read();
       }

       return builder.toString();
   }

   public int nextInt() throws IOException {
       int ret = 0;
       byte c = read();
       while (c <= ' ')
           c = read();
        boolean neg = (c == '-');
       if (neg)
           c = read();
       do {
           ret = ret * 10 + c - '0';
       } while ((c = read()) >= '0' && c <= '9');

       if (neg)
           return -ret;
       return ret;
   }

   public int[] nextIntArray( int n) throws IOException {
        int arr[] = new int[n];
       for(int i = 0; i < n; i++){
           arr[i] = nextInt();
       }
       return arr;
   }

   public long nextLong() throws IOException {
       long ret = 0;
       byte c = read();
       while (c <= ' ')
           c = read();
        boolean neg = (c == '-');
       if (neg)
           c = read();
       do {
           ret = ret * 10 + c - '0';
       } while ((c = read()) >= '0' && c <= '9');
       if (neg)
           return -ret;
       return ret;
   }

   public long[] nextLongArray( int n) throws IOException {
        long arr[] = new long[n];
       for(int i = 0; i < n; i++){
           arr[i] = nextLong();
       }
       return arr;
   }

   public char nextChar() throws IOException{
       byte c = read();
       while(Character.isWhitespace(c)){
           c = read();
       }
       return (char) c;
   }

   public double nextDouble() throws IOException {
       double ret = 0, div = 1;
       byte c = read();
       while (c <= ' ')
           c = read();
        boolean neg = (c == '-');
       if (neg)
           c = read();

       do {
           ret = ret * 10 + c - '0';
       } while ((c = read()) >= '0' && c <= '9');

       if (c == '.') {
           while ((c = read()) >= '0' && c <= '9') {
               ret += (c - '0') / (div *= 10);
           }
       }

       if (neg)
           return -ret;
       return ret;
   }

   public double[] nextDoubleArray( int n) throws IOException {
        double arr[] = new double[n];
       for(int i = 0; i < n; i++){
           arr[i] = nextDouble();
       }
       return arr;
   }

   private void fillBuffer() throws IOException {
       bytesRead = din.read(buffer, bufferPointer = 0, BUFFER_SIZE);
       if (bytesRead == -1)
           buffer[0] = -1;
   }

   private byte read() throws IOException {
       if (bufferPointer == bytesRead)
           fillBuffer();
       return buffer[bufferPointer++];
   }

   public void close() throws IOException {
       if (din == null)
           return;
       din.close();
   }

}


import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.OutputStreamWriter;
import java.io.PrintWriter;
import java.util.Arrays;
import java.util.StringTokenizer;

public class Main {
    BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
    StringTokenizer tokenizer = null;
    int totalCases, testNum;

    PrintWriter out = new PrintWriter(new BufferedWriter(new OutputStreamWriter(System.out)));

    void solve() throws IOException {

    }

    void execute() throws IOException {
        long n = nl();
        StringBuilder sb = new StringBuilder();
        while (n > 0) {
            n--;
            sb.append((char)(n%26 + 'a'));
            n /= 26;
        }
        out.println(sb.reverse().toString());

        out.close();
    }

    public static void main(String[] args) throws IOException {
        new Main().execute();
    }

    void debug(Object... os) {
        System.out.println(Arrays.deepToString(os));
    }

    int ni() throws IOException {
        return Integer.parseInt(ns());
    }

    long nl() throws IOException {
        return Long.parseLong(ns());
    }

    double nd() throws IOException {
        return Double.parseDouble(ns());
    }

    String ns() throws IOException {
        while (tokenizer == null || !tokenizer.hasMoreTokens()) {
            tokenizer = new StringTokenizer(br.readLine());
        }
        return tokenizer.nextToken();
    }

    String nline() throws IOException {
        tokenizer = null;
        return br.readLine();
    }

    boolean input() throws IOException {
        return true;
    }

}


import java.util.*;
import java.io.*;

public class Main {

	private static void solve(){
		//Implement solution here.
		long N = nl();
		StringBuilder sb = new StringBuilder();
		while(N > 0) {
//			System.out.println(N);
			long rem = -1;
			if(N % 26 == 0) {
				rem = 26;
				if(N == 26) {
					N = 0;
				} else {
					N /= 26L;
					N--;
				}
			} else {
				rem = N % 26L;
				N /= 26L;
			}
			sb.insert(0,(char)(rem + 96L));

		}
		System.out.println(sb.toString());
	}

	//Switch input source (stdin/file)
	private static BufferedReader br;
	public static void main(String[] args){
		br = new BufferedReader(new InputStreamReader(System.in));
		String debugDataPath = System.getenv("DD_PATH");
		if(debugDataPath != null){
			try{
				br = new BufferedReader(new InputStreamReader(new FileInputStream(new File(debugDataPath))));
			}catch(Exception e){
				throw new RuntimeException(e);
			}
		}
		boolean hasNext = true;
		while(hasNext){
			solve();
			try{
				br.mark(1);
				if(br.read() > 0){
					br.reset();
					System.out.println("---");
				} else {
					hasNext = false;
				}
			}catch(Exception e){
				throw new RuntimeException(e);
			}
		}
	}

	//Input read utility
	private static StringTokenizer tokenizer = null;
	public static String next() {
		while (tokenizer == null || !tokenizer.hasMoreTokens()) {
			try {
				tokenizer = new StringTokenizer(br.readLine());
			} catch (Exception e) {
				throw new RuntimeException(e);
			}
		}
		return tokenizer.nextToken();
	}
	//Get next single int
	private static int ni() {
		return Integer.parseInt(next());
	}
	//Get next single long
	private static long nl() {
		return Long.parseLong(next());
	}
	//Get next single double
	private static double nd() {
		return Double.parseDouble(next());
	}
	//Get next int array from one line
	private static int[] na(int n) {
		int[] a = new int[n];
		for (int i = 0; i < n; i++)
			a[i] = ni();
		return a;
	}
	//Get next char array from one line
	private static char[] ns() {
		return next().toCharArray();
	}
	//Get next long array from one line
	private static long[] nal(int n) {
		long[] a = new long[n];
		for (int i = 0; i < n; i++)
			a[i] = nl();
		return a;
	}
}


import java.util.Scanner;

public class Main {

	static long mod = 1000000007;
	static long INF = Long.MAX_VALUE;

	static long chmin(long a, long b) {
		return Math.min(a, b);
	}

	static long chmax(long a, long b) {
		return Math.max(a, b);
	}

	public static void main(String[] args) {
		// AtCoder_C
		Scanner sc = new Scanner(System.in);
		long N = sc.nextLong();
	    // Scannerクラスのインスタンスをクローズ
		sc.close();

		String ans = "";

		while (N>0) {
			N -= 1;
			ans += (char)('a'+(N%26));
			N /= 26;
		}

		System.out.print(ans);
	}
}


import java.util.Scanner;

public class Main {

	static long mod = 1000000007;
	static long INF = Long.MAX_VALUE;

	static void function(double N) {
		if(N != 0) {
			int mod = (int) (N%26);
			if(mod == 0) {
				mod=26;
			}

			if(N-26 > 0) {
				function((long) N/26);
			}

			if(mod != 0) {
				System.out.print((char)(mod+96));
			}
		}
	}

	static long chmin(long a, long b) {
		return Math.min(a, b);
	}

	static long chmax(long a, long b) {
		return Math.max(a, b);
	}

	public static void main(String[] args) {
		// AtCoder_C
		Scanner sc = new Scanner(System.in);
		Double N = sc.nextDouble();
	    // Scannerクラスのインスタンスをクローズ
		sc.close();

		function(N);
	}
}


import java.util.Scanner;

public class Main {

	static long mod = 1000000007;
	static long INF = Long.MAX_VALUE;

	static void function(double N) {
		if(N != 0) {
			int mod = (int) (N%26);
			if(mod == 0) {
				mod = 26;
			}

			long x = (long) (N/26);
			if(x != 1) {
				function(x);
			}
			if(mod != 0) {
				System.out.print((char)(mod+96));
			}
		}
	}

	static long chmin(long a, long b) {
		return Math.min(a, b);
	}

	static long chmax(long a, long b) {
		return Math.max(a, b);
	}

	public static void main(String[] args) {
		// AtCoder_C
		Scanner sc = new Scanner(System.in);
		Double N = sc.nextDouble();
	    // Scannerクラスのインスタンスをクローズ
		sc.close();

		function(N);
	}
}


// This is free and unencumbered software released into the public domain.

// Anyone is free to copy, modify, publish, use, compile, sell, or
// distribute this software, either in source code form or as a compiled
// binary, for any purpose, commercial or non-commercial, and by any
// means.

// In jurisdictions that recognize copyright laws, the author or authors
// of this software dedicate any and all copyright interest in the
// software to the public domain. We make this dedication for the benefit
// of the public at large and to the detriment of our heirs and
// successors. We intend this dedication to be an overt act of
// relinquishment in perpetuity of all present and future rights to this
// software under copyright law.

// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
// IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR
// OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
// ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
// OTHER DEALINGS IN THE SOFTWARE.

// For more information, please refer to <http://unlicense.org>

/****************/
/* template.hpp */
/****************/

#include <algorithm>
#include <cassert>
#include <functional>
#include <iomanip>
#include <iostream>
#include <limits>

using std::cerr;
using std::cout;
using std::endl;
using std::max;
using std::min;
using std::swap;

struct BoolName : std::numpunct<char> {
  std::string t, f;
  BoolName(std::string t, std::string f) : t(t), f(f) {}
  std::string do_truename() const { return t; }
  std::string do_falsename() const { return f; }
};

void setBoolName(std::string t, std::string f) {
  cout.imbue(std::locale(cout.getloc(), new BoolName(t, f)));
}

struct Initializer {
  Initializer() {
    cout << std::fixed << std::setprecision(15) << std::boolalpha;
    setBoolName("Yes", "No");
  }
} initializer;

struct Input {
  bool eof;

  Input() : eof(false) {}

  operator bool() {
    int v;
    this->eof = (std::scanf("%d", &v) != 1);
    return v;
  }

  operator char() {
    char v;
    while (!(this->eof = (std::scanf("%c", &v) != 1)) && std::isspace(v)) {
    }
    return v;
  }

  operator int() {
    int v;
    this->eof = (std::scanf("%d", &v) != 1);
    return v;
  }

  operator long() {
    long v;
    this->eof = (std::scanf("%ld", &v) != 1);
    return v;
  }

  operator long long() {
    long long v;
    this->eof = (std::scanf("%lld", &v) != 1);
    return v;
  }

  operator unsigned int() {
    unsigned int v;
    this->eof = (std::scanf("%u", &v) != 1);
    return v;
  }

  operator unsigned long() {
    unsigned long v;
    this->eof = (std::scanf("%lu", &v) != 1);
    return v;
  }

  operator unsigned long long() {
    unsigned long long v;
    this->eof = (std::scanf("%llu", &v) != 1);
    return v;
  }

  operator double() {
    double v;
    this->eof = (std::scanf("%lf", &v) != 1);
    return v;
  }

  operator long double() {
    long double v;
    this->eof = (std::scanf("%Lf", &v) != 1);
    return v;
  }

  void ignore() const { getchar(); }
} in;

template <typename T> T abs(T a) { return a >= 0 ? a : -a; }

template <typename T, typename S> bool chmin(T &a, const S &b) {
  return a > b ? a = b, true : false;
}

template <typename T, typename S> bool chmax(T &a, const S &b) {
  return a < b ? a = b, true : false;
}

template <typename T, typename S> std::function<S(T)> cast() {
  return [](const T &t) { return static_cast<S>(t); };
}

template <typename T> T copy(const T &a) { return T(a); }

class ZeroPadding {
public:
  ZeroPadding(int n) : n(n) {}

  int n;
};

std::ostream &operator<<(std::ostream &os, const ZeroPadding &z) {
  os << std::setw(z.n) << std::setfill('0');
  return os;
}

template <typename T> constexpr T inf() {
  return std::numeric_limits<T>::max() / 2 - 1;
}

/****************/
/* math/pow.hpp */
/****************/

template <typename T> struct is_integral;

template <> struct is_integral<int> { using value_type = int; };

template <> struct is_integral<long> { using value_type = long; };

template <> struct is_integral<long long> { using value_type = long long; };

template <> struct is_integral<unsigned> { using value_type = unsigned; };

template <> struct is_integral<unsigned long> {
  using value_type = unsigned long;
};

template <> struct is_integral<unsigned long long> {
  using value_type = unsigned long long;
};

template <typename T> typename is_integral<T>::value_type identity(const T &m) {
  (void)m;
  return T(1);
}

template <typename T> auto identity(const T &m) -> decltype(T::identity(0)) {
  return T::identity(m.size());
}

template <typename T> auto identity(const T &m) -> decltype(T::identity()) {
  (void)m;
  return T::identity();
}

template <typename T> T pow(const T &m, int64_t n) {
  if (n == 0) {
    return identity<T>(m);
  } else if (n < 0) {
    return identity<T>(m) / pow(m, -n);
  }
  T mm = pow(m, n / 2);
  mm *= mm;
  if (n % 2) {
    mm *= m;
  }
  return mm;
}
/*************/
/* tuple.hpp */
/*************/

#include <tuple>

template <typename... T> class Tuple : public std::tuple<T...> {
public:
  Tuple(Input &in) : std::tuple<T...>() { (void)in; }
};

template <typename T, typename... S>
class Tuple<T, S...> : public std::tuple<T, S...> {
public:
  Tuple() : std::tuple<T, S...>() {}

  Tuple(T t, S... s) : std::tuple<T, S...>(t, s...) {}

  Tuple(const std::tuple<T, S...> &t) : std::tuple<T, S...>(t) {}

  Tuple(Input &in) {
    auto a = std::tuple<T>(in);
    std::tuple<S...> b = Tuple<S...>(in);
    std::tuple<T, S...> c = std::tuple_cat(a, b);
    *this = c;
  }

  template <int n> auto &get() { return std::get<n>(*this); }

  template <int n> const auto &get() const { return std::get<n>(*this); }
};

template <typename... T> Tuple<T...> makeTuple(const T &... args) {
  return Tuple<T...>(args...);
}

namespace std {
template <typename... T>
class tuple_size<Tuple<T...>>
    : public std::integral_constant<size_t, sizeof...(T)> {};
template <std::size_t I, typename... T> class tuple_element<I, Tuple<T...>> {
public:
  using type = tuple_element_t<I, std::tuple<T...>>;
};
} // namespace std

/*****************/
/* container.hpp */
/*****************/

#include <vector>

template <typename T> class Container : public T {
private:
  using S = typename T::value_type;
  using Itr = typename T::iterator;

public:
  Container() : T() {}

  Container(int n) : T(n) {}

  Container(int n, S s) : T(n, s) {}

  template <typename Itr> Container(Itr first, Itr last) : T(first, last) {}

  Container(const std::initializer_list<S> &v) : T(v) {}

  Container(int n, Input &in) {
    std::vector<S> v(n);
    for (auto &i : v) {
      i = in;
    }
    *this = Container<T>(v.begin(), v.end());
  }

  S max() const { return *std::max_element(this->begin(), this->end()); }

  template <typename Function> auto max(Function func) const {
    std::vector<std::pair<decltype(func(S())), S>> res;
    for (const auto &i : *this) {
      res.emplace_back(func(i), i);
    }
    return std::max_element(res.begin(), res.end())->second;
  }

  S min() const { return *std::min_element(this->begin(), this->end()); }

  Tuple<S, S> minmax() const {
    auto itrs = std::minmax_element(this->begin(), this->end());
    return Tuple<S, S>(*itrs.first, *itrs.second);
  }

  template <typename Function> auto min(Function func) const {
    std::vector<std::pair<decltype(func(S())), S>> res;
    for (const auto &i : *this) {
      res.emplace_back(func(i), i);
    }
    return std::min_element(res.begin(), res.end())->second;
  }

  int argmax() const {
    return std::distance(this->begin(),
                         std::max_element(this->begin(), this->end()));
  }

  int argmin() const {
    return std::distance(this->begin(),
                         std::min_element(this->begin(), this->end()));
  }

  int find(const S &a) const {
    return std::distance(this->begin(),
                         std::find(this->begin(), this->end(), a));
  }

  bool contains(const S &a) const {
    return std::find(this->begin(), this->end(), a) != this->end();
  }

  int size() const { return T::size(); }

  std::pair<Itr, Itr> equal_range(const S &a) {
    return std::equal_range(this->begin(), this->end(), a);
  }

  template <typename Function> bool all_of(Function func) const {
    return std::all_of(this->begin(), this->end(), func);
  }

  template <typename Function> bool any_of(Function func) const {
    return std::any_of(this->begin(), this->end(), func);
  }

  template <typename Function> bool none_of(Function func) const {
    return std::none_of(this->begin(), this->end(), func);
  }

  int count(const S &s) const {
    return std::count(this->begin(), this->end(), s);
  }

  bool is_sorted() const { return std::is_sorted(this->begin(), this->end()); }

  void output(std::string sep = "\n", std::string end = "\n") const {
    bool first = true;
    for (const auto &i : *this) {
      if (!first) {
        cout << sep;
      }
      first = false;
      cout << i;
    }
    cout << end;
  }
};

/***********/
/* map.hpp */
/***********/

#include <map>

template <typename T, typename S> class Map : public Container<std::map<T, S>> {
public:
  Map() : Container<std::map<T, S>>() {}

  bool contains(const T &a) const { return this->count(a) != 0; }

  int count(const T &t) const { return std::map<T, S>::count(t); }
};
/***************/
/* ordered.hpp */
/***************/

template <typename T> class Ordered {
public:
  template <typename V> bool operator==(const V &v) const {
    return !(static_cast<T>(v) < static_cast<const T &>(*this) ||
             static_cast<const T &>(*this) < static_cast<T>(v));
  }

  template <typename V> bool operator!=(const V &v) const {
    return static_cast<T>(v) < static_cast<const T &>(*this) ||
           static_cast<const T &>(*this) < static_cast<T>(v);
  }

  template <typename V> bool operator>(const V &v) const {
    return static_cast<T>(v) < static_cast<const T &>(*this);
  }

  template <typename V> bool operator<=(const V &v) const {
    return !(static_cast<T>(v) < static_cast<const T &>(*this));
  }

  template <typename V> bool operator>=(const V &v) const {
    return !(static_cast<const T &>(*this) < static_cast<T>(v));
  }
};

/**************/
/* vector.hpp */
/**************/

#include <numeric>

template <typename T> class Vector : public Container<std::vector<T>> {
public:
  Vector() = default;

  Vector(const Vector<T> &v) = default;

  Vector(int n) : Container<std::vector<T>>(n) {}

  Vector(int n, T t) : Container<std::vector<T>>(n, t) {}

  template <typename Itr>
  Vector(Itr first, Itr last) : Container<std::vector<T>>(first, last) {}

  Vector(const std::initializer_list<T> &v) : Container<std::vector<T>>(v) {}

  Vector(int n, Input &in) : Container<std::vector<T>>(n, in) {}

  Vector &operator+=(const Vector &v) {
    if (this->size() < v.size()) {
      this->resize(v.size());
    }
    for (int i = 0; i < v.size(); ++i) {
      (*this)[i] += v[i];
    }
    return *this;
  }

  Vector &operator+=(const T &v) {
    for (auto &i : *this) {
      i += v;
    }
    return *this;
  }

  Vector &operator-=(const Vector &v) {
    if (this->size() < v.size()) {
      this->resize(v.size());
    }
    for (int i = 0; i < v.size(); ++i) {
      (*this)[i] -= v[i];
    }
    return *this;
  }

  Vector &operator-=(const T &v) {
    for (auto &i : *this) {
      i -= v;
    }
    return *this;
  }

  Vector &operator*=(const Vector &v) {
    for (int i = 0; i < this->size(); ++i) {
      (*this)[i] *= v[i];
    }
    return *this;
  }

  Vector &operator*=(const T &v) {
    for (auto &i : *this) {
      i *= v;
    }
    return *this;
  }

  Vector &operator/=(const Vector &v) {
    for (int i = 0; i < this->size(); ++i) {
      (*this)[i] /= v[i];
    }
    return *this;
  }

  Vector &operator/=(const T &v) {
    for (auto &i : *this) {
      i /= v;
    }
    return *this;
  }

  Vector &operator%=(const Vector &v) {
    for (int i = 0; i < this->size(); ++i) {
      (*this)[i] %= v[i];
    }
    return *this;
  }

  Vector &operator%=(const T &v) {
    for (auto &i : *this) {
      i %= v;
    }
    return *this;
  }

  Vector operator+(const Vector &v) const { return Vector(*this) += v; }

  Vector operator+(const T &v) const { return Vector(*this) += v; }

  Vector operator-(const Vector &v) const { return Vector(*this) -= v; }

  Vector operator-(const T &v) const { return Vector(*this) -= v; }

  Vector operator*(const Vector &v) const { return Vector(*this) *= v; }

  Vector operator*(const T &v) const { return Vector(*this) *= v; }

  Vector operator/(const Vector &v) const { return Vector(*this) /= v; }

  Vector operator/(const T &v) const { return Vector(*this) /= v; }

  Vector operator%(const Vector &v) const { return Vector(*this) %= v; }

  Vector operator%(const T &v) const { return Vector(*this) %= v; }

  Vector operator-() const { return *this * -1; }

  T inner_product(const Vector<T> &v) const {
    return std::inner_product(this->begin(), this->end(), v.begin(), T(0));
  }

  Vector<T> &partial_sort(int k, bool reverse = false) {
    if (!reverse) {
      std::partial_sort(this->begin(), this->begin() + k, this->end());
    } else {
      std::partial_sort(this->begin(), this->begin() + k, this->end(),
                        std::greater<T>());
    }
    return *this;
  }

  Vector<T> &sort() {
    std::sort(this->begin(), this->end());
    return *this;
  }

  template <typename Function> Vector<T> &sort(Function func) {
    std::sort(this->begin(), this->end(), func);
    return *this;
  }

  Vector<T> &rsort() {
    std::sort(this->rbegin(), this->rend());
    return *this;
  }

  Vector<int> argsort() const {
    Vector<Tuple<T, int>> v;
    for (int i = 0; i < this->size(); ++i) {
      v.emplace_back((*this)[i], i);
    }
    v.sort();
    auto f = [](const Tuple<T, int> &t) { return t.template get<1>(); };
    return v.transform(f);
  }

  Vector<T> &nth_element(int n, bool reverse = false) {
    if (!reverse) {
      std::nth_element(this->begin(), this->begin() + n, this->end());
    } else {
      std::nth_element(this->begin(), this->begin() + n, this->end(),
                       std::greater<T>());
    }
    return *this;
  }

  Vector<T> subvector(int a, int b = -1) const {
    if (b == -1) {
      return Vector<T>(this->begin() + a, this->end());
    }
    return Vector<T>(this->begin() + a, this->begin() + b);
  }

  template <typename Function> auto transform(Function func) const {
    Vector<decltype(func(T()))> res;
    std::transform(this->begin(), this->end(), std::back_inserter(res), func);
    return res;
  }

  Vector<T> partial_sum() const {
    Vector<T> res;
    std::partial_sum(this->begin(), this->end(), std::back_inserter(res));
    return res;
  }

  template <typename Function> Vector<T> partial_sum(Function func) const {
    Vector<T> res;
    std::partial_sum(this->begin(), this->end(), std::back_inserter(res), func);
    return res;
  }

  Vector<T> &reverse() {
    std::reverse(this->begin(), this->end());
    return *this;
  }

  template <typename Function> int count_if(Function func) const {
    return std::count_if(this->begin(), this->end(), func);
  }

  Vector<T> adjacent_difference() const {
    Vector<T> res;
    std::adjacent_difference(this->begin(), this->end(),
                             std::back_inserter(res));
    return res;
  }

  T lower_bound(T t) const {
    return std::lower_bound(this->begin(), this->end(), t) - this->begin();
  }

  T upper_bound(T t) const {
    return std::upper_bound(this->begin(), this->end(), t) - this->begin();
  }

  T accumulate() const {
    return std::accumulate(this->begin(), this->end(), T());
  }

  template <typename S, typename Function>
  S accumulate(S n, Function func) const {
    return std::accumulate(this->begin(), this->end(), n, func);
  }

  template <typename Int> static Vector<T> makeVector(Int n) {
    return Vector<T>(n);
  }

  template <typename Int> static Vector<T> makeVector(Input &in, Int n) {
    return Vector<T>(n, in);
  }

  template <typename Int, typename... Ints>
  static auto makeVector(Input &in, Int n, Ints... ints) {
    Vector<decltype(makeVector(in, ints...))> res;
    for (int i = 0; i < n; ++i) {
      res.emplace_back(makeVector(in, ints...));
    }
    return res;
  }

  template <typename Int, typename... Ints>
  static auto makeVector(Int n, Ints... ints) {
    Vector<decltype(makeVector(ints...))> res;
    for (int i = 0; i < n; ++i) {
      res.emplace_back(makeVector(ints...));
    }
    return res;
  }

  Vector<T> &unique() {
    this->erase(std::unique(this->begin(), this->end()), this->end());
    return *this;
  }

  bool next_permutation() {
    return std::next_permutation(this->begin(), this->end());
  }

  Vector<T> &rotate(int n) {
    std::rotate(this->begin(), this->begin() + n, this->end());
    return *this;
  }

  Map<T, int> countAll() const {
    Map<T, int> res;
    for (const auto &i : *this) {
      ++res[i];
    }
    return res;
  }

  T matmul(const T &a) const {
    return this->transform([&](const T &i) { return i.inner_product(a); });
  }
};

template <typename T> Vector<T> iota(int n, T m = 0) {
  Vector<T> v(n);
  std::iota(v.begin(), v.end(), m);
  return v;
}

template <typename T, typename S> void read(Vector<T> &t, Vector<S> &s) {
  for (int i = 0; i < t.size(); ++i) {
    t[i] = T(in);
    s[i] = S(in);
  }
}

template <typename T, typename S, typename U>
void read(Vector<T> &t, Vector<S> &s, Vector<U> &u) {
  for (int i = 0; i < t.size(); ++i) {
    t[i] = T(in);
    s[i] = S(in);
    u[i] = U(in);
  }
}

template <typename T> Vector<T> operator+(const T &a, const Vector<T> &b) {
  return b + a;
}

template <typename T> Vector<T> operator-(const T &a, const Vector<T> &b) {
  return -b + a;
}

template <typename T> Vector<T> operator*(const T &a, const Vector<T> &b) {
  return b * a;
}

/**************/
/* string.hpp */
/**************/

#include <string>

class String : public std::string {
public:
  constexpr static auto npos = std::string::npos;

  String() : std::string() {}

  String(char c) : std::string(1, c) {}

  String(int n) : std::string(std::to_string(n)) {}

  String(long n) : std::string(std::to_string(n)) {}

  String(long long n) : std::string(std::to_string(n)) {}

  String(const char *s) : std::string(s) {}

  String(const std::string &s) : std::string(s) {}

  String(int n, char c) : std::string(n, c) {}

  String(Input &in) {
    std::cin >> *this;
    in.eof = std::cin.eof();
  }

  String &operator+=(const String &s) { return *this = *this + s; }

  String operator+(const String &s) const { return std::operator+(*this, s); }

  String &operator+=(const char *s) { return *this = *this + s; }

  String operator+(const char *s) const { return std::operator+(*this, s); }

  String &operator+=(char s) { return *this = *this + s; }

  String operator+(char s) const { return std::operator+(*this, s); }

  String operator*(int n) const {
    String res;
    for (int i = 0; i < n; ++i) {
      res += *this;
    }
    return res;
  }

  static String getline() {
    String v;
    std::getline(std::cin, v);
    in.eof = std::cin.eof();
    return v;
  }

  String substr(size_t pos, size_t n_pos = std::string::npos) {
    return std::string::substr(pos, n_pos);
  }

  String &reverse() {
    std::reverse(this->begin(), this->end());
    return *this;
  }

  Vector<String> split(char delim = ' ') const {
    std::stringstream ss(*this);
    Vector<String> res;
    for (std::string tmp; std::getline(ss, tmp, delim);) {
      if (tmp != "") {
        res.emplace_back(tmp);
      }
    }
    return res;
  }

  String &toupper() {
    for (auto &c : *this) {
      c = std::toupper(c);
    }
    return *this;
  }

  String &tolower() {
    for (auto &c : *this) {
      c = std::tolower(c);
    }
    return *this;
  }

  template <typename Function> String transform(Function func) const {
    String res;
    std::transform(this->begin(), this->end(), std::back_inserter(res), func);
    return res;
  }

  bool contains(const String &s) const {
    return this->find(s) != std::string::npos;
  }

  String &erase(char c) {
    String res;
    for (char i : *this) {
      if (i != c) {
        res += i;
      }
    }
    return *this = res;
  }

  int count(char c) const { return std::count(this->begin(), this->end(), c); }

  template <bool Repeat = false>
  String &replaceAll(const String &from, const String &to) {
    for (size_t pos = 0; (pos = this->find(from, pos)) != std::string::npos;) {
      this->replace(pos, from.size(), to);
      if (!Repeat) {
        pos += to.size();
      }
    }
    return *this;
  }

  String &sort() {
    std::sort(this->begin(), this->end());
    return *this;
  }

  String &rsort() {
    std::sort(this->rbegin(), this->rend());
    return *this;
  }

  String &unique() {
    std::string::erase(std::unique(this->begin(), this->end()), this->end());
    return *this;
  }

  String &rotate(int n) {
    std::rotate(this->begin(), this->begin() + n, this->end());
    return *this;
  }

  bool next_permutation() {
    return std::next_permutation(this->begin(), this->end());
  }

  template <typename T, typename Function1, typename Function2>
  T inner_product(const String &v, T init, Function1 func1,
                  Function2 func2) const {
    return std::inner_product(this->begin(), this->end(), v.begin(), init,
                              func1, func2);
  }

  template <typename Function> int find_if(Function func) const {
    return std::find_if(this->begin(), this->end(), func) - this->begin();
  }

  template <typename Function> bool all_of(Function func) const {
    return std::all_of(this->begin(), this->end(), func);
  }

  template <typename Function> bool any_of(Function func) const {
    return std::any_of(this->begin(), this->end(), func);
  }

  template <typename Function> bool none_of(Function func) const {
    return std::none_of(this->begin(), this->end(), func);
  }

  Vector<int> find_all(const String &s) const {
    Vector<int> res;
    auto pos = this->find(s);
    while (pos != String::npos) {
      res.emplace_back(pos);
      pos = this->find(s, pos + 1);
    }
    return res;
  }

  int size() const { return std::string::size(); }

  operator int() const { return std::stoi(*this); }

  operator long() const { return std::stol(*this); }

  operator long long() const { return std::stoll(*this); }

  operator float() const { return std::stof(*this); }

  operator double() const { return std::stod(*this); }

  operator long double() const { return std::stold(*this); }
};

bool islower(char c) { return 'a' <= c && c <= 'z'; }

bool isupper(char c) { return 'a' <= c && c <= 'z'; }

/************/
/* main.cpp */
/************/

int main() {
  int64_t n(in);
  --n;
  for (int i = 1;; ++i) {
    int64_t c = pow(int64_t(26), i);
    if (n < c) {
      String res = "";
      for (int j = 0; j < i; ++j) {
        res += char('a' + n % 26);
        n /= 26;
      }
      cout << res.reverse() << endl;
      break;
    }
    n -= c;
  }
}


#include <algorithm>
#include <iostream>
#include <iomanip>
#include <cassert>
#include <cstring>
#include <string>
#include <vector>
#include <random>
#include <bitset>
#include <queue>
#include <cmath>
#include <unordered_map>
#include <set>
#include <map>
#define INCANT cin.tie(0), cout.tie(0), ios::sync_with_stdio(0), cout << fixed << setprecision(20);
#define rep(i,n) for (int i=0; i<n;++i)
#define ALL(a)  (a).begin(),(a).end()
#define PI 3.14159265358979
typedef long long ll;
using namespace std;
const ll MOD = 1e9+7LL;
const int INF = 2e9;
ll N;

vector<char> calc(ll N) {
  vector<char> ret;
  while(N>0) {
    ll i = N%26ll;
    if (i==0) {
      ret.push_back('z');
      N-=26;
    }
    else {
      char c = i+'`';
      ret.push_back(c);
    }
    N/=26;
  }
  return ret;
}

int main() {
  INCANT;
  cin >> N;
  vector<char> vec = calc(N);
  for (int i=vec.size()-1; i>=0; i--) {
    cout << vec[i];
  }
  cout << "\n";
  return 0;
}


# include <iostream>
using namespace std;
int main(){
    long long n;
    cin>>n;
    string s="";
    while(n--){
        s="a"+s;
        s[0]+=(n%26);
        n/=26;
    }
    cout<<s<<endl;
    return 0;
}


#include <cstdio>
#include <cmath>
#include <limits>
#include <fstream>
#include <iostream>
#include <algorithm>
#include <vector>
#include <utility>
#include <cstring>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <cstdint>
#include <functional>
#include <sstream>
#define rep(i, s, g) for (i = s; i < g; i++)
using namespace std;
using ll = long long;
using ss = stringstream;

const ll mod = 1000000000 + 7; //10^9
const ll llmax = pow(10, 18);

// bool is_integer(double x){
//     return floor(x) == x;
// }

// struct factorial
// {
//     vector<ll> fac, finv, inv;

//     factorial(int n) : fac(2, 1), finv(2, 1), inv(2, 1)
//     {
//         int i;

//         rep(i, 2, n + 1)
//         {
//             fac.push_back(fac[i - 1] * i % mod);
//             inv.push_back(mod - inv[mod % i] * (mod / i) % mod);
//             finv.push_back(finv[i - 1] * inv[i] % mod);
//         }
//     }

//     ll comb(int n, int k)
//     {
//         if (n < k)
//         {
//             return 0;
//         }

//         if (n < 0 || k < 0)
//         {
//             return 0;
//         }

//         return fac[n] * (finv[k] * finv[n - k] % mod) % mod;
//     }

//     ll perm(int n, int k)
//     {
//         if (n < k)
//         {
//             return 0;
//         }

//         if (n < 0 || k < 0)
//         {
//             return 0;
//         }

//         return fac[n] * finv[n - k] % mod;
//     }
// };
// ll power(ll x, ll y)
// {
//     ll ans = 1;
//     while (y)
//     {
//         if (y & 1)
//             ans = (ans * x) % mod;
//         x = (x * x) % mod;
//         y >>= 1;
//     }
//     return ans;
// }

// ll mod_conb(ll n, ll k)
// {
//     ll ans = 1;

//     if (n < k || n < 0 || k < 0)
//     {
//         return 0;
//     }

//     for (long long i = 0; i < k; i++)
//     {
//         ans *= n - i;
//         ans %= mod;
//         ans *= power(i + 1, mod - 2);
//         ans %= mod;
//     }

//     return ans;
// }
// struct unionfind
// {
//     vector<long long> d;

//     unionfind(long long n) : d(n, -1) {}

//     long long root(long long x)
//     {
//         if (d[x] < 0)
//         {
//             return x;
//         }
//         else
//         {
//             return d[x] = root(d[x]);
//         }
//     }

//     bool unite(long long x, long long y)
//     {
//         x = root(x);
//         y = root(y);

//         if (x == y)
//         {
//             return false;
//         }

//         if (d[x] > d[y])
//         {
//             swap(x, y);
//         }

//         d[x] += d[y];
//         d[y] = x;
//         return true;
//     }

//     bool same(long long x, long long y)
//     {
//         return root(x) == root(y);
//     }

//     long long size(long long x)
//     {
//         return -d[root(x)];
//     }
// };

/*逆元　あまりの割り算をするときにこいつをかける(a/b→a*modinv(b))*/
// mod. m での a の逆元 a^{-1} を計算する
// ll modinv(ll a,ll m){
//     long long b = m, u = 1, v = 0;
//     while (b) {
//         long long t = a / b;
//         a -= t * b; swap(a, b);
//         u -= t * v; swap(u, v);
//     }
//     u %= m;
//     if (u < 0) u += m;
//     return u;
// }

// bool IsPrime(ll num)
// {
//     if (num < 2) return false;
//     else if (num == 2) return true;
//     else if (num % 2 == 0) return false; // 偶数はあらかじめ除く

//     double sqrtNum = sqrt(num);
//     for (int i = 3; i <= sqrtNum; i += 2)
//     {
//         if (num % i == 0)
//         {
            // 素数ではない
//             return false;
//         }
//     }

    // 素数である
//     return true;
// }

 /*階乗*/
// ll facctorialMethod(ll k){
//     ll sum = 1;
//     for (ll i = 1; i <= k; ++i)
//     {
//         sum *= i;
        //sum%=MOD;//あまりを出力せよ問題の時はこれもやる
//     }
//     return sum;
// }

// vector<int> Eratosthenes(ll N )
// {
//     vector<bool> is_prime( N + 1 );
//     for( int i = 0; i <= N; i++ )
//     {
//         is_prime[ i ] = true;
//     }
//     vector<int> P;
//     for( int i = 2; i <= N; i++ )
//     {
//         if( is_prime[ i ] )
//         {
//             for( int j = 2 * i; j <= N; j += i )
//             {
//                 is_prime[ j ] = false;
//             }
//             P.emplace_back( i );
//         }
//     }
//     return P;
// }

// vector<int> Decimal_to_Alphabet(ll a){

// }

int main() {
    ll n; cin >> n;
    vector<ll> a(20);
    for (int i = 0; i < 20; i++)
    {
        for (int j = 0; j <= i; j++)
        {
            a[i] += pow(26, j);
        }
        // cout << a[i] << endl;
    }
    int s;
    for (int i = 0; i < 20; i++)
    {
        if(n >= a[i] && n < a[i + 1]){
            s = i;
            break;
        }
    }
    // cout << s << endl;
    string ans = "";
    for (int i = s; i >= 0; i--)
    {
        int t;
        ll p = n;
        // int cnt = 0;
        for (int j = 0; j < i; j++)
        {
            p /= 26;

        }
        // cout  << "p="<< p << endl;

        if(p >=26) p = 26;
        n -= p * (ll)pow(26, i);
        // cout << "n" << n << endl;
        // while (p > 26)
        // {

        //     p = p/26;
        //     cnt ++;
        // }
        if(p == 0) p++;
        char x = (char)(p + 'a' - 1);
        ans = ans + x;

    }
    cout << ans << endl;
}