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

public class test {
	public static void main(String[] args) {
//		int test = fs.nextInt();
		int test = 1;
		for (int cases = 0; cases < test; cases++) {
			int n=fs.nextInt();
			String s=fs.next();
			int count=0;
			for(int i=0;i<n;i++)
			{
				int x=s.charAt(i)-'0';
				if(x%2==0)
				{
					count+=(i+1);
				}
			}
			op.print(count);
		op.flush();
		}

	}

	/*
	 * array list
	 *
	 * ArrayList<Integer> al=new ArrayList<>(); creating BigIntegers
	 *
	 * BigInteger a=new BigInteger(); BigInteger b=new BigInteger();
	 *
	 * hash map
	 *
	 * HashMap<Integer,Integer> hm=new HashMap<Integer,Integer>(); for(int
	 * i=0;i<ar.length;i++) { Integer c=hm.get(ar[i]); if(hm.get(ar[i])==null) {
	 * hm.put(ar[i],1); } else { hm.put(ar[i],++c); } }
	 *
	 * while loop
	 *
	 * int t=sc.nextInt(); while(t>0) { t--; }
	 *
	 * array input
	 *
	 * int n = sc.nextInt(); int ar[] = new int[n]; for (int i = 0; i < ar.length;
	 * i++) { ar[i] = sc.nextInt(); }
	 */
	static boolean isPrime(int n) {
		// Corner cases
		if (n <= 1)
			return false;
		if (n <= 3)
			return true;

		// This is checked so that we can skip
		// middle five numbers in below loop
		if (n % 2 == 0 || n % 3 == 0)
			return false;

		for (int i = 5; i * i <= n; i = i + 6)
			if (n % i == 0 || n % (i + 2) == 0)
				return false;

		return true;
	}

	static class Graph {
		HashMap<Integer, LinkedList<Integer>> hm = new HashMap<Integer, LinkedList<Integer>>();

		private void addVertex(int vertex) {
			hm.put(vertex, new LinkedList<>());
		}

		private void addEdge(int source, int dest, boolean bi) {
			if (!hm.containsKey(source))
				addVertex(source);
			if (!hm.containsKey(dest))
				addVertex(dest);
			hm.get(source).add(dest);
			if (bi) {
				hm.get(dest).add(source);
			}
		}

		private boolean uniCycle(int i, HashSet<Integer> visited, int parent) {
			visited.add(i);
			LinkedList<Integer> list = hm.get(i);
			Iterator<Integer> it = list.iterator();
			while (it.hasNext()) {
				Integer integer = (Integer) it.next();
				if (!visited.contains(integer)) {
					if (uniCycle(integer, visited, i))
						return true;
				} else if (integer != parent) {
					return true;
				}
			}
			return false;
		}

		private boolean uniCyclic() {
			HashSet<Integer> visited = new HashSet<Integer>();
			Set<Integer> set = hm.keySet();
			for (Integer integer : set) {
				if (!visited.contains(integer)) {
					if (uniCycle(integer, visited, -1)) {
						return true;
					}
				}
			}
			return false;
		}

		private boolean isbiCycle(int i, HashSet<Integer> visited, HashSet<Integer> countered) {
			if (countered.contains(i))
				return true;
			if (visited.contains(i))
				return false;
			visited.add(i);
			countered.add(i);
			LinkedList<Integer> list = hm.get(i);
			Iterator<Integer> it = list.iterator();
			while (it.hasNext()) {
				Integer integer = (Integer) it.next();
				if (isbiCycle(integer, visited, countered)) {
					return true;
				}
			}
			countered.remove(i);
			return false;
		}

		private boolean isbiCyclic() {
			HashSet<Integer> visited = new HashSet<Integer>();
			HashSet<Integer> countered = new HashSet<Integer>();
			Set<Integer> set = hm.keySet();
			for (Integer integer : set) {
				if (isbiCycle(integer, visited, countered)) {
					return true;
				}
			}
			return false;
		}
	}

	static class Node {
		Node left, right;
		int data;

		public Node(int data) {
			this.data = data;
		}

		public void insert(int val) {
			if (val <= data) {
				if (left == null) {
					left = new Node(val);
				} else {
					left.insert(val);
				}
			} else {
				if (right == null) {
					right = new Node(val);
				} else {
					right.insert(val);
				}
			}
		}

		public boolean contains(int val) {
			if (data == val) {
				return true;
			} else if (val < data) {
				if (left == null) {
					return false;
				} else {
					return left.contains(val);
				}
			} else {
				if (right == null) {
					return false;
				} else {
					return right.contains(val);
				}
			}
		}

		public void inorder() {
			if (left != null) {
				left.inorder();
			}
			System.out.print(data + " ");
			if (right != null) {
				right.inorder();
			}
		}

		public int maxDepth() {
			if (left == null)
				return 0;
			if (right == null)
				return 0;
			else {
				int ll = left.maxDepth();
				int rr = right.maxDepth();
				if (ll > rr)
					return (ll + 1);
				else
					return (rr + 1);
			}
		}

		public int countNodes() {
			if (left == null)
				return 1;
			if (right == null)
				return 1;
			else {
				return left.countNodes() + right.countNodes() + 1;
			}
		}

		public void preorder() {
			System.out.print(data + " ");
			if (left != null) {
				left.inorder();
			}

			if (right != null) {
				right.inorder();
			}

		}

		public void postorder() {
			if (left != null) {
				left.inorder();
			}

			if (right != null) {
				right.inorder();
			}
			System.out.print(data + " ");

		}

		public void levelorder(Node node) {
			LinkedList<Node> ll = new LinkedList<Node>();
			ll.add(node);
			getorder(ll);

		}

		public void getorder(LinkedList<Node> ll) {
			while (!ll.isEmpty()) {
				Node node = ll.poll();
				System.out.print(node.data + " ");
				if (node.left != null)
					ll.add(node.left);
				if (node.right != null)
					ll.add(node.right);
			}
		}
	}

	static class FastReader {
		BufferedReader br;
		StringTokenizer st;

		public FastReader() {
			br = new BufferedReader(new InputStreamReader(System.in));
		}

		String next() {
			while (st == null || !st.hasMoreElements()) {
				try {
					st = new StringTokenizer(br.readLine());
				} catch (IOException e) {
					e.printStackTrace();
				}
			}
			return st.nextToken();
		}

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

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

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

		String nextLine() {
			String str = "";
			try {
				str = br.readLine();
			} catch (IOException e) {
				e.printStackTrace();
			}
			return str;
		}
	}

	static class Pair {
		int first, second;

		public Pair(int first, int second) {
			this.first = first;
			this.second = second;
		}

	}

	static class OutputWriter {
		private final PrintWriter writer;

		public OutputWriter(OutputStream outputStream) {
			writer = new PrintWriter(new BufferedWriter(new OutputStreamWriter(outputStream)));
		}

		public OutputWriter(Writer writer) {
			this.writer = new PrintWriter(writer);
		}

		public void print(Object... objects) {
			for (int i = 0; i < objects.length; i++) {
				if (i != 0)
					writer.print(' ');
				writer.print(objects[i]);
			}
		}

		public void printLine(Object... objects) {
			print(objects);
			writer.println();
		}

		public void close() {
			writer.close();
		}

		public void flush() {
			writer.flush();
		}

	}

	private static final Scanner sc = new Scanner(System.in);
	private static final FastReader fs = new FastReader();
	private static final OutputWriter op = new OutputWriter(System.out);

	static int[] getintarray(int n) {
		int ar[] = new int[n];
		for (int i = 0; i < n; i++) {
			ar[i] = fs.nextInt();
		}
		return ar;
	}

	static long[] getlongarray(int n) {
		long ar[] = new long[n];
		for (int i = 0; i < n; i++) {
			ar[i] = fs.nextLong();
		}
		return ar;
	}

	static int[][] get2darray(int n, int m) {
		int ar[][] = new int[n][m];
		for (int i = 0; i < n; i++) {
			for (int j = 0; j < m; j++) {
				ar[i][j] = fs.nextInt();
			}
		}
		return ar;
	}

	static Pair[] getpairarray(int n) {
		Pair ar[] = new Pair[n];
		for (int i = 0; i < n; i++) {
			ar[i] = new Pair(fs.nextInt(), fs.nextInt());
		}
		return ar;
	}

	static void printarray(int ar[]) {
		for (int i : ar) {
			op.print(i + " ");
		}
		op.flush();
	}

	static int fact(int n) {
		int fact = 1;
		for (int i = 2; i <= n; i++) {
			fact *= i;
		}
		return fact;
	}

//

	// function to find largest prime factor

}/*
	 * 1 5 -2 -3 -1 -4 -6till here
	 */

//		while (t > 0) {
//			int a[] = getintarray(3);
//			int b[] = getintarray(3);
//			int ans = getans(a, b);
//			System.out.println(ans);
//		}


import java.io.*;
import java.util.*;
import java.text.*;
import java.math.*;
import java.util.regex.*;
import java.lang.*;
public class Main{
	static long mod = 1000000007;
	static InputReader in = new InputReader(System.in);
	static PrintWriter pw = new PrintWriter(System.out);
	public static void main(String[] args) throws Exception {
		// int t=in.readInt();
		 //while(t-->0){
			int n=in.readInt();
			String s=in.readString();
			int ans=0;
			for(int i=0;i<n;i++) {
				int r=(int)s.charAt(i);
				if(r%2==0) {
					ans+=(i+1);
				}
			}
			System.out.println(ans);
			//long n=in.readLong();
			// String a=in.readString();
		//}
	}
	static String removeChar(String s,int a,int b) {
		return s.substring(0,a)+s.substring(b,s.length());
	}
	static int[]  nextIntArray(int n){
		int[] arr= new int[n];
		int i=0;
		while(i<n){
			arr[i++]=in.readInt();
		}
		return arr;
	}
	static long[] nextLongArray(int n){
		long[]arr= new long[n];
		int i=0;
		while(i<n){
			arr[i++]=in.readLong();
		}
		return arr;
	}
	static int[]  nextIntArray1(int n) {
		int[] arr= new int[n+1];
		int i=1;
		while(i<=n){
			arr[i++]=in.readInt();
		}
		return arr;
	}
	static long[] nextLongArray1(int n){
		long[]arr= new long[n+1];
		int i=1;
		while(i<=n) {
			arr[i++]=in.readLong();
		}
		return arr;
	}
	static long gcd(long x, long y) {
		if (x % y == 0)
			return y;
		else
			return gcd(y, x % y);
	}
	static long pow(long n, long m) {
		if(m==0)
			return 1;
		else if(m==1)
			return n;
		else {
			long r=pow(n,m/2);
			if(m%2==0)
				return r*r;
			else
				return r*r*n;
		}
	}
	static long max(long a,long b,long c) {
		return Math.max(Math.max(a, b),c);
	}
	static long min(long a,long b,long c) {
		return Math.min(Math.min(a, b), c);
	}
	static class Pair implements Comparable<Pair> {
		int a, b;
		Pair(int a, int b) {
			this.a = a;
			this.b = b;
		}
		public int compareTo(Pair o) {
			if (this.a != o.a)
				return Integer.compare(this.a, o.a);
			else
				return Integer.compare(this.b, o.b);
			// return 0;
		}
		public boolean equals(Object o) {
			if (o instanceof Pair) {
				Pair p = (Pair) o;
				return p.a == a && p.b == b;
			}
			return false;
		}
		public int hashCode() {
			return new Integer(a).hashCode() * 31 + new Integer(b).hashCode();
		}
	}
	static class InputReader {
		private InputStream stream;
		private byte[] buf = new byte[1024];
		private int curChar;
		private int numChars;
		private SpaceCharFilter filter;
		public InputReader(InputStream stream) {
			this.stream = stream;
		}
		public int read() {
			if (numChars == -1)
				throw new InputMismatchException();
			if (curChar >= numChars) {
				curChar = 0;
				try {
					numChars = stream.read(buf);
				} catch (IOException e) {
					throw new InputMismatchException();
				}
				if (numChars <= 0)
					return -1;
			}
			return buf[curChar++];
		}
		public int readInt() {
			int c = read();
			while (isSpaceChar(c))
				c = read();
			int sgn = 1;
			if (c == '-') {
				sgn = -1;
				c = read();
			}
			int res = 0;
			do {
				if (c < '0' || c > '9')
					throw new InputMismatchException();
				res *= 10;
				res += c - '0';
				c = read();
			} while (!isSpaceChar(c));
			return res * sgn;
		}
		public String readString() {
			int c = read();
			while (isSpaceChar(c))
				c = read();
			StringBuilder res = new StringBuilder();
			do {
				res.appendCodePoint(c);
				c = read();
			} while (!isSpaceChar(c));
			return res.toString();
		}
		public double readDouble() {
			int c = read();
			while (isSpaceChar(c))
				c = read();
			int sgn = 1;
			if (c == '-') {
				sgn = -1;
				c = read();
			}
			double res = 0;
			while (!isSpaceChar(c) && c != '.') {
				if (c == 'e' || c == 'E')
					return res * Math.pow(10, readInt());
				if (c < '0' || c > '9')
					throw new InputMismatchException();
				res *= 10;
				res += c - '0';
				c = read();
			}
			if (c == '.') {
				c = read();
				double m = 1;
				while (!isSpaceChar(c)) {
					if (c == 'e' || c == 'E')
						return res * Math.pow(10, readInt());
					if (c < '0' || c > '9')
						throw new InputMismatchException();
					m /= 10;
					res += (c - '0') * m;
					c = read();
				}
			}
			return res * sgn;
		}
		public long readLong() {
			int c = read();
			while (isSpaceChar(c))
				c = read();
			int sgn = 1;
			if (c == '-') {
				sgn = -1;
				c = read();
			}
			long res = 0;
			do {
				if (c < '0' || c > '9')
					throw new InputMismatchException();
				res *= 10;
				res += c - '0';
				c = read();
			} while (!isSpaceChar(c));
			return res * sgn;
		}
		public boolean isSpaceChar(int c) {
			if (filter != null)
				return filter.isSpaceChar(c);
			return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
		}
		public String next() {
			return readString();
		}
		public interface SpaceCharFilter {
			public boolean isSpaceChar(int ch);
		}
	}
}


import java.util.Scanner;
public class q1{
	public static void main(String[] args) {
		Scanner s = new Scanner(System.in);
		int count=0;
		int n=s.nextInt();
		String s1=s.next();

		for(int i=0;i<=n-1;i++)
		{
			if(s1.charAt(i)=='2' ||s1.charAt(i)=='4' || s1.charAt(i)=='6'||s1.charAt(i)=='8')
			{
				count=count+i+1;
			}
		}
		System.out.println(count);
	}
}


import java.util.Scanner;

public class EvenSubstrings {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        String s = sc.next();
        int ans = 0;
        for (int i = 0; i < n; i++)
        {
            if ("02468".contains(s.substring(i,i+1)))
            {
                ans += i + 1;
            }
        }
        System.out.println(ans);
    }
}


import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.util.Arrays;
import java.util.StringTokenizer;

public class Solution {
	public static void main ( String args [] ) throws IOException {

			solve();}

public static void solve() throws IOException {
Scanner sc = new Scanner(System.in);
int n=sc.nextInt();
int count=0;
String s= sc.next();
for(int i=0;i<s.length();i++) {
	if(Integer.parseInt(s.charAt(i)+"")%2==0) {
		count=count+i+1;
	}
}
System.out.println(count);
}

static void shuffle(int[] a)
{
	int n = a.length;
	for(int i = 0; i < n; i++)
	{
		int r = i + (int)(Math.random() * (n - i));
		int tmp = a[i];
		a[i] = a[r];
		a[r] = tmp;
	}
}

}

class Triple{
	int start;
	int end;
	int peaks;
	public Triple(int s,int e,int p) {
		this.start=s;
		this.end=e;
		this.peaks=p;
	}
}

class Scanner
{
	StringTokenizer st;
	BufferedReader br;

	public Scanner(InputStream s){	br = new BufferedReader(new InputStreamReader(s));}

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

	public int nextInt() throws IOException {return Integer.parseInt(next());}

	public long nextLong() throws IOException {return Long.parseLong(next());}

	public String nextLine() throws IOException {return br.readLine();}

	public double nextDouble() throws IOException
	{
		String x = next();
		StringBuilder sb = new StringBuilder("0");
		double res = 0, f = 1;
		boolean dec = false, neg = false;
		int start = 0;
		if(x.charAt(0) == '-')
		{
			neg = true;
			start++;
		}
		for(int i = start; i < x.length(); i++)
			if(x.charAt(i) == '.')
			{
				res = Long.parseLong(sb.toString());
				sb = new StringBuilder("0");
				dec = true;
			}
			else
			{
				sb.append(x.charAt(i));
				if(dec)
					f *= 10;
			}
		res += Long.parseLong(sb.toString()) / f;
		return res * (neg?-1:1);
	}

	public boolean ready() throws IOException {return br.ready();}

}


import java.util.*;
public class Solution {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		String s = sc.next();
		int x = 0;
		for (int i=0;i<n;i++) {
			if (s.charAt(i)=='2'||s.charAt(i)=='4'||s.charAt(i)=='6'||s.charAt(i)=='8'||s.charAt(i)=='0')
				x=x+i+1;
		}
		System.out.println(x);
	}
}


import java.util.Scanner;

public class Even_Substring {

	public static void main(String[] args) {
		//
		Scanner in = new Scanner(System.in);
		int n=in.nextInt();
		String s=in.next();
		int count=0;
		for(int i=0;i<n;i++) {
			if(s.charAt(i)=='2'||s.charAt(i)=='4'||s.charAt(i)=='6'||s.charAt(i)=='8') {
			for(int j=0;j<=i;j++){
				count++;
			}
		}

	}
		System.out.println(count);

}
}


import java.util.Scanner;

public class Even_Substring {

	public static void main(String[] args) {
	/* instead of Creating a second loop we could parse the char into integer and find if it's  modulo==0:increment count*/
		Scanner in = new Scanner(System.in);
		int n=in.nextInt();
		String s=in.next();
		int count=0;
		for(int i=0;i<s.length();i++) {
		int c=s.charAt(i)-'0';
		if(c%2==0)count+=(i+1);
		}
		System.out.println(count);

}
}


import java.util.Scanner;

public class Even_Substring {

	public static void main(String[] args) {
/* instead of Creating a second loop we could parse the char into integer and find if it's  modulo==0:increment count*/
		Scanner in = new Scanner(System.in);
		int n=in.nextInt();
		String s=in.next();
		int count=0;
		for(int i=0;i<s.length();i++) {
		int c=s.charAt(i)-'0';
		if(c%2==0)count=(i+1);
		}
		System.out.println(count);

}
}


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
 *
 * @author ky112233
 */
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);
        AEvenSubstrings solver = new AEvenSubstrings();
        solver.solve(1, in, out);
        out.close();
    }

    static class AEvenSubstrings {
        public void solve(int testNumber, Scanner in, PrintWriter out) {
            int n = in.nextInt();
            String str = in.next();
            int cnt = 0;
            for (int i = 0; i < n; i++) {
                int num = str.charAt(i) - '0';
                if (num % 2 == 0) {
                    cnt += i + 1;
                }
            }
            out.println(cnt);
        }

    }
}


import java.util.*;
public class Sample{

    public static void main(String args[]){
    Scanner sc = new Scanner(System.in);
    int n = sc.nextInt();
    sc.nextLine();
    String s = sc.nextLine();
    int res=0;
    for(int i=0; i<n; i++) {
     int t = (int)(s.charAt(i));
        if(t%2==0)
        res += i+1;
    }
    System.out.println(res);
      //  System.out.println("Hello World");
    }
}


import java.util.Arrays;
import java.util.Collections;
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();
      long sum=0;
      for(int i=n-1;i>=0;i--){
          if((s.charAt(i)-'0')%2==0){
              sum+=i+1;
          }

      }
        System.out.println(sum);
    }
}


import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.HashMap;
import java.util.PriorityQueue;
import java.util.Scanner;
import java.util.StringTokenizer;

public class code11 {

	public static void main(String[] args) {
		// TODO Auto-generated method stub
		FastReader scn = new FastReader();
		PrintWriter out = new PrintWriter(System.out);

			int T = 1;
			while(T-->0) {
				int n = scn.nextInt();
				String str = scn.next();
				long ans = 0;
				for(int i=0; i<n; i++) {
					if(Integer.parseInt(String.valueOf(str.charAt(i)))%2 == 0)
						ans += i+1;
				}

				out.print(ans);
			}
			out.flush();
	}

	public static class Pair implements Comparable<Pair>{
		int a;
		int b;
		Pair(int x, int y){
			a= x;
			b= y;
		}
		public int compareTo(Pair p) {
			if(this.b-this.a == p.b-p.a)
				return p.a - this.a;
			return (this.b-this.a) - (p.b - p.a);
		}
	}

	public static void fill(int[][] mat, int a) {
		int n = mat.length;
		int m = mat[0].length;
		for(int i=0; i<n; i++) {
			for(int j=0; j<m; j++)
				mat[i][j] = a;
		}
	}

	public static void fill(int[] arr, int a) {
		int n = arr.length;
		for(int i=0;i<n; i++)
			arr[i] = a;
	}

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

	public static int lcm(int a, int b) {
		return (a*b)/gcd(a,b);
	}

	static class FastReader {
		BufferedReader br;
		StringTokenizer st;

		public FastReader() {
			br = new BufferedReader(new InputStreamReader(System.in));
		}

		String next() {
			while (st == null || !st.hasMoreElements()) {
				try {
					st = new StringTokenizer(br.readLine());
				} catch (IOException e) {
					e.printStackTrace();
				}
			}
			return st.nextToken();
		}

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

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

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

		String nextLine() {
			String str = "";
			try {
				str = br.readLine();
			} catch (IOException e) {
				e.printStackTrace();
			}
			return str;
		}
	}

}


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

public class Main {
    private static void solver(InputReader sc, PrintWriter out) throws Exception {
        int  n = sc.nextInt();
        String s = sc.next();
        long ans=0;
        for(int i=0; i<n; i++){
            int x = (int)s.charAt(i)-48;
            if(x%2==0){
                ans += i+1;
            }
        }
        out.println(ans);

    }

    private static int gcd (int a, int b) {
        if (b == 0)
            return a;
        else
            return gcd (b, a % b);
    }
    private static int gcd (int a, int b, int c) {
        int gcd1 = gcd(a,b);
        return gcd(gcd1,c);
    }

    private static long helper(long x){
        long ans = (x * (x-1))/2;
        return ans;
    }
    public static void main(String[] args) throws Exception {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        InputReader in = new InputReader(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        solver(in,out);
        out.close();
    }
    static class InputReader {
        public BufferedReader reader;
        public StringTokenizer tokenizer;

        public InputReader(InputStream stream) {
            reader = new BufferedReader(new InputStreamReader(stream), 32768);
            tokenizer = null;
        }

        public String next() {
            while (tokenizer == null || !tokenizer.hasMoreTokens()) {
                try {
                    tokenizer = new StringTokenizer(reader.readLine());
                } catch (IOException e) {
                    throw new RuntimeException(e);
                }
            }
            return tokenizer.nextToken();
        }

        public int nextInt() {
            return Integer.parseInt(next());
        }
        public long nextLong() {
            return Long.parseLong(next());
        }
        public int[] readIntArray(int n){
            int arr[] = new int[n];
            for(int i=0;i<n;i++) arr[i] = nextInt();
            return arr;
        }
    }
}
class Pair {
    int x;
    int y;

    Pair(int x, int y) {
        this.x = x;
        this.y = y;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;
        Pair pair = (Pair) o;
        return x == pair.x &&
                y == pair.y;
    }

    @Override
    public int hashCode() {
        return Objects.hash(x, y);
    }
}


import java.util.*;
import java.io.*;
public class Main {
  public static void main(String[] args) {
    Scanner in = new Scanner(System.in);
    int n = in.nextInt();
    String s = in.next();
    int x = 0;
    for(int i = 0; i < n; i++){
      if(Character.getNumericValue(s.charAt(i))%2 == 0){
        x += i+1;
      }
    }
    System.out.println(x);
  }
}


import java.util.*;
public class Main {
    public static int function(String s,int n)
    {
        int ans = 0;
        for (int i = 0; i < n; i++)
        {
           for (int j = i+1; j <= n; j++)
           {
               int x = Integer.parseInt(s.substring(i, j));
               if(x%2==0)
                    ans++;
           }
        }
           return ans;
    }
    public static void main(String args[]) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		String s = sc.next();
		System.out.println(function(s,n));
    }
}


import java.util.*;
public class Main {
    public static int function(String s)
    {
        int ans = 0;
        int n  = s.length();
        for (int i = 0; i < n; i++)
           for (int j = i+1; j <= n; j++)
           {
               int x = Integer.parseInt(s.substring(i, j));
               if(x%2==0)
                    ans++;
           }
           return ans;
    }
    public static void main(String args[]) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		String s = sc.next();
		int ans = function(s);
		System.out.println(ans);
    }
}


import java.util.*;
public class Main {
    public static int function(String s,int n)
    {
        int ans = 0;
        for (int i = 0; i < n; i++)
        {
           for (int j = i+1; j <= n; j++)
           {
               int x =Integer.valueOf(s.substring(i, j));
               if(x%2==0)
                    ans++;
           }
        }
           return ans;
    }
    public static void main(String args[]) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		String s = sc.next();
		System.out.println(function(s,n));
    }
}


import java.util.*;
public class Main {
    public static int function(String s)
    {
        int ans = 0;
        int n  = s.length();
        for (int i = 0; i < n; i++)
           for (int j = i+1; j <= n; j++)
           {
               int x = Integer.parseInt(s.substring(i, j));
               if(x%2==0)
                    ans++;
           }
           return ans;
    }
    public static void main(String args[]) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		String s = sc.next();
		System.out.println(function(s));
    }
}


import java.util.*;
public class GFG {

	static int evenNumSubstring(String str)
	{
		int len = str.length();
		int count = 0;

		for (int i = 0; i < len; i++)
		{
			int temp = str.charAt(i) - '0';
			if (temp % 2 == 0)
				count += (i + 1);
		}

		return count;
	}

	public static void main(String args[])
	{
	    Scanner sc = new Scanner(System.in);
	    int n = sc.nextInt();
	    String str = sc.next();
		System.out.println(evenNumSubstring(str));
	}
}


//package com.company;
import java.util.*;
public class Main {

    public static void main(String[] args) {
        // write your code here

        Scanner s=new Scanner(System.in);StringBuilder sb=new StringBuilder();
       int n=s.nextInt();char[] a=s.next().toCharArray();long ans=0;
       for(int i=0;i<n;i++){
           if(a[i]%2==0){
               ans+=i+1;
           }
       }
        System.out.println(ans);
    }
}

class Student
{
    int rollno,x,pos;
//    String name, address;

    // Constructor
    public Student(int rollno, int x,int pos)
    {
        this.rollno = rollno;
        this.x=x;this.pos=pos;
    }

    // Used to print student details in main()
    public String toString()
    {
        return this.rollno + " " +this.x;
    }
}

class Sortbyroll implements Comparator<Student>
{
    // Used for sorting in ascending order of
    // roll number
    public int compare(Student a, Student b)
    {
        return  b.x-a.x;
    }
}


import java.util.*;

public class EvenSubstrings {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    int n = sc.nextInt();
    String s = sc.next();
    int numEvenSubstrings = 0;
    for (int i = 0; i < s.length(); ++i) {
      if (((s.charAt(i) - '0') % 2) == 0) {
        numEvenSubstrings += i + 1;
      }
    }
    System.out.println(numEvenSubstrings);
  }
}


import java.util.*;
import static java.lang.Math.*;
public class Demo{
	public static void main(String[] args) {
		Scanner in = new Scanner(System.in);
		int n = in.nextInt();
		String s = in.next();
		int count = 0;
		for (int i = 0; i < n; i++){
			if (Character.getNumericValue(s.charAt(i))%2==0){
				count+=i+1;
			}
		}
		System.out.println(count);

	}
}


// Java program to count number of
// substring which are even integer
// in a string of digits.
import java.util.*;
public class even{

    // Return the even number substrings.
     public static int evenNumSubstring(String str)
    {
        int len = str.length();
        int count = 0;

        for (int i = 0; i < len; i++)
        {
            int temp = str.charAt(i) - '0';

            // If current digit is even, add
            // count of substrings ending with
            // it. The count is (i+1)
            if (temp % 2 == 0)
                count += (i + 1);
        }

        return count;
    }

    public static void main(String args[])
    {

        String str;int m;
        Scanner sc = new Scanner(System.in);
        m = sc.nextInt();
        str= sc.next();

        System.out.println(evenNumSubstring(str));
    }
}


import java.io.*;
import java.util.*;
import java.util.logging.Level;
import java.util.logging.Logger;
import static java.lang.System.*;

public class NewClass {
    public static BufferedReader br;
    static FastReader s = new FastReader();

    public static void main(String[] args){
        int t = s.nextInt();
        while(t-->0){
        try {
            solve();
        } catch (IOException ex) {
            Logger.getLogger(NewClass.class.getName()).log(Level.SEVERE, null, ex);
        }
        }
    }

    static void solve() throws IOException{
       String ab;
       ab = s.nextLine();
       int count = 0;
       for(int i = 0; i<ab.length();i++){
           if((int)(ab.charAt(i))%2 == 0)
               count += i+1;
       }
       println(count);
    }

    static class FastReader{
        private StringTokenizer st;

        public FastReader(){
            br = new BufferedReader(new InputStreamReader(System.in));
        }

        String next(){
            while(st == null || !st.hasMoreElements()){
                try {
                    st = new StringTokenizer(br.readLine());
                } catch (IOException ex) {
                    Logger.getLogger(NewClass.class.getName()).log(Level.SEVERE, null, ex);
                }
            }
            return st.nextToken();
        }

        String nextLine(){
            String str = "";
            try {
                str = br.readLine();
            } catch (IOException ex) {
                Logger.getLogger(NewClass.class.getName()).log(Level.SEVERE, null, ex);
            }
            return str;
        }

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

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

        float nextFloat(){
            return Float.parseFloat(next());
        }

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

    static void println(String sr){
        out.println(sr);
    }

    static void println(long in){
        out.println(in);
    }

    static void println(double dou){
        out.println(dou);
    }
    static void println(float flo){
       out.println(flo);
    }

    static void print(String sr){
        out.println(sr);
    }

    static void print(long in){
        out.println(in);
    }

    static void print(double dou){
        out.println(dou);
    }
    static void print(float flo){
       out.println(flo);
    }

}


import java.io.*;
import java.util.*;
import java.util.logging.Level;
import java.util.logging.Logger;
import static java.lang.System.*;

public class NewClass {
    public static BufferedReader br;
    static FastReader s = new FastReader();

    public static void main(String[] args){
        int t = s.nextInt();
        while(t-->0){
        try {
            solve();
        } catch (IOException ex) {
            Logger.getLogger(NewClass.class.getName()).log(Level.SEVERE, null, ex);
        }
        }
    }

    static void solve() throws IOException{
       String ab;
       int n = s.nextInt();
       ab = s.nextLine();
       int count = 0;
       for(int i = 0; i<ab.length();i++){
           if((int)(ab.charAt(i))%2 == 0)
               count += i+1;
       }
       println(count);
    }

    static class FastReader{
        private StringTokenizer st;

        public FastReader(){
            br = new BufferedReader(new InputStreamReader(System.in));
        }

        String next(){
            while(st == null || !st.hasMoreElements()){
                try {
                    st = new StringTokenizer(br.readLine());
                } catch (IOException ex) {
                    Logger.getLogger(NewClass.class.getName()).log(Level.SEVERE, null, ex);
                }
            }
            return st.nextToken();
        }

        String nextLine(){
            String str = "";
            try {
                str = br.readLine();
            } catch (IOException ex) {
                Logger.getLogger(NewClass.class.getName()).log(Level.SEVERE, null, ex);
            }
            return str;
        }

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

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

        float nextFloat(){
            return Float.parseFloat(next());
        }

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

    static void println(String sr){
        out.println(sr);
    }

    static void println(long in){
        out.println(in);
    }

    static void println(double dou){
        out.println(dou);
    }
    static void println(float flo){
       out.println(flo);
    }

    static void print(String sr){
        out.println(sr);
    }

    static void print(long in){
        out.println(in);
    }

    static void print(double dou){
        out.println(dou);
    }
    static void print(float flo){
       out.println(flo);
    }

}


import java.io.*;
import java.util.*;
import java.util.logging.Level;
import java.util.logging.Logger;
import static java.lang.System.*;

public class NewClass {
    public static BufferedReader br;
    static FastReader s = new FastReader();

    public static void main(String[] args){
        //int t = s.nextInt();
        //while(t-->0){
        try {
            solve();
        } catch (IOException ex) {
            Logger.getLogger(NewClass.class.getName()).log(Level.SEVERE, null, ex);
        }
        //}
    }

    static void solve() throws IOException{
       String ab;
       int n = s.nextInt();
       ab = s.nextLine();
       int count = 0;
       for(int i = 0; i<ab.length();i++){
           if((int)(ab.charAt(i))%2 == 0)
               count += i+1;
       }
       println(count);
    }

    static class FastReader{
        private StringTokenizer st;

        public FastReader(){
            br = new BufferedReader(new InputStreamReader(System.in));
        }

        String next(){
            while(st == null || !st.hasMoreElements()){
                try {
                    st = new StringTokenizer(br.readLine());
                } catch (IOException ex) {
                    Logger.getLogger(NewClass.class.getName()).log(Level.SEVERE, null, ex);
                }
            }
            return st.nextToken();
        }

        String nextLine(){
            String str = "";
            try {
                str = br.readLine();
            } catch (IOException ex) {
                Logger.getLogger(NewClass.class.getName()).log(Level.SEVERE, null, ex);
            }
            return str;
        }

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

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

        float nextFloat(){
            return Float.parseFloat(next());
        }

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

    static void println(String sr){
        out.println(sr);
    }

    static void println(long in){
        out.println(in);
    }

    static void println(double dou){
        out.println(dou);
    }
    static void println(float flo){
       out.println(flo);
    }

    static void print(String sr){
        out.println(sr);
    }

    static void print(long in){
        out.println(in);
    }

    static void print(double dou){
        out.println(dou);
    }
    static void print(float flo){
       out.println(flo);
    }

}


import java.util.*;
public class Main
{
	public static void main(String[] args) {
		Scanner sc=new Scanner(System.in);
    	long i,l,count=0;
    	l=sc.nextLong();
    	String s;
    	s=sc.next();
    	for(i=0;i<l;i++)
    	{
    		if ((s.charAt((int)i)-'0')%2==0) count+=(i+1);
    	}
    	System.out.println(count);
	}
}


import java.util.*;
import java.io.*;
public class A548
{
    public static void main(String [] args)
    {
        MyScanner sc = new MyScanner();
        PrintWriter out = new PrintWriter(new BufferedOutputStream(System.out));
        int n = sc.nextInt(); int [] a = new int [n];
        String s = sc.next();
        for (int i = 0; i < n; i++) a[i] = Integer.parseInt(s.substring(i, i+ 1));
        long ans = 0;
        for (int i = 0; i < n; i++) {
            if (a[i] % 2 == 0) ans = ans + (i + 1);
        }
        out.println(ans);
        out.close();
    }

    //-----------MyScanner class for faster input----------
    public static class MyScanner {
        BufferedReader br;
        StringTokenizer st;

        public MyScanner() {
            br = new BufferedReader(new InputStreamReader(System.in));
        }

        String next() {
            while (st == null || !st.hasMoreElements()) {
                try {
                    st = new StringTokenizer(br.readLine());
                } catch (IOException e) {
                    e.printStackTrace();
                }
            }
            return st.nextToken();
        }

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

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

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

        String nextLine(){
            String str = "";
            try {
                str = br.readLine();
            } catch (IOException e) {
                e.printStackTrace();
            }
            return str;
        }

    }

}


/* package codechef; // don't place package name! */

import java.util.*;
import java.lang.*;
import java.io.*;
import java.util.Arrays;
import java.math.BigInteger;

/* Name of the class has to be "Main" only if the class is public. */
public class Main
{
     public static void main (String[] args) throws java.lang.Exception
     {
     	Scanner in =new Scanner(System.in);
		int t,i,j,l=0,h=0,n,m=0,k,p=0;
		String s="",st="";
		n=in.nextInt();
		s=in.next();
		char c[]=s.toCharArray();
		for(i=0;i<n;i++)
		{
		     p=(int)(c[i]-48);
		     if(p%2==0)
		     m=m+(i+1);
		}
		System.out.println(m);
	}
}


import java.util.Scanner;

public class A1139_EvenSubstrings {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        int n = scanner.nextInt();
        scanner.nextLine();
        String s = scanner.nextLine();
        int cnt = 0;
        for (int i = 0; i < n; i++) {
            if (Integer.parseInt(String.valueOf(s.charAt(i))) % 2 == 0)
                cnt += i + 1;
        }
        System.out.println(cnt);
    }
}


import java.math.BigInteger;
import java.util.Scanner;

public class A1139_EvenSubstrings {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        int n = scanner.nextInt();
        scanner.nextLine();
        String s = scanner.nextLine();
        BigInteger intS;
        BigInteger TWO = new BigInteger("2");
        int cnt = 0;
        for (int i = 0; i < n; i++) {
            for (int j = i+1; j <=n ; j++) {
                intS = new BigInteger(s.substring(i, j));
                if (intS.mod(TWO).equals(BigInteger.ZERO))
                    cnt++;
            }
        }
        System.out.println(cnt);
    }
}


import java.util.Scanner;

public class A1139_EvenSubstrings {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        int n = scanner.nextInt();
        scanner.nextLine();
        String s = scanner.nextLine();
        int cnt = 0;
        for (int i = 0; i < n; i++) {
            for (int j = i + 1; j <= n; j++) {
                if (Integer.parseInt(String.valueOf(s.charAt(j-1))) % 2 == 0)
                    cnt++;
            }
        }
        System.out.println(cnt);
    }
}


import java.util.Scanner;

public class A1139_EvenSubstrings {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        int n = scanner.nextInt();
        scanner.nextLine();
        String s = scanner.nextLine();
        int cnt = 0;
        for (int i = 0; i < n; i++) {
            for (int j = i+1; j <=n ; j++) {
                if (Integer.parseInt(s.substring(i,j)) % 2 == 0)
                    cnt++;
            }
        }
        System.out.println(cnt);
    }
}


package SetA;

import java.util.Scanner;

public class A1139_EvenSubstrings {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        int n = scanner.nextInt();
        scanner.nextLine();
        String s = scanner.nextLine();
        int cnt = 0;
        for (int i = 0; i < n; i++) {
            for (int j = i + 1; j <= n; j++) {
                if (Integer.parseInt(String.valueOf(s.charAt(j-1))) % 2 == 0)
                    cnt++;
            }
        }
        System.out.println(cnt);
    }
}


import java.util.*;
import java.lang.*;
import java.io.*;
public class codeforces
{
    public static void main (String[] args)
    {
        Scanner sc=new Scanner(System.in);

        int x = sc.nextInt();
        String s = sc.next();
        int count = 0;
        for(int i = 0; i<x; i++){
            if(s.charAt(i)=='2'||s.charAt(i)=='4'||s.charAt(i)=='6'||s.charAt(i)=='8'){
                count+=1+i;
            }
        }
        System.out.println(count);

    }
}


import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner scan = new Scanner(System.in);
        int n = scan.nextInt();
        scan.nextLine();
        String word = scan.nextLine();

        int count = 0;

        for (int i = 0; i < n; i++) {
            if (Integer.parseInt(Character.toString(word.charAt(i))) % 2 == 0) {
                count += i + 1;
            }
        }

        System.out.println(count);
    }
}


import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner scan = new Scanner(System.in);
        int n = scan.nextInt();
        scan.nextLine();
        String word = scan.nextLine();

        int count = 0;

        for (int i = 0; i < n; i++) {
            for (int j = 0; j <= i; j++) {
                if (Integer.parseInt(Character.toString(word.charAt(i))) % 2 == 0) {
                    count++;
                }
            }
        }

        System.out.println(count);
    }
}


//codeforces 700
                        import java.io.*;
                        import java.util.*;
                        import java.util.Arrays;
                        import static java.lang.System.out;
                        public class EvenSubstrings
                        {
                            public static void main(String args[])
                            {
                               Scanner sc=new Scanner(System.in);
                               int n=sc.nextInt();
                               sc.nextLine();
                               String s=sc.nextLine();
                               char c[]=s.toCharArray();
                               int i,sum=0;
                               for(i=0;i<n;i++)
                               {
                                  char e=s.charAt(i);
                                  if((e-'0')%2==0)
                                  sum+=(i+1);
                                }
                                out.println(sum);
                            }//main ends
                        }//class ends


import java.io.*;
import java.util.*;
public class substring
{
    public static void main(String[] args)throws IOException
    {
         BufferedReader reader =new BufferedReader(new InputStreamReader(System.in));
        int l=Integer.parseInt(reader.readLine());
         String s=reader.readLine();
        int c=0;
        for(int i=0;i<l;i++)
        {
            char ch=s.charAt(i);
            int n=Character.getNumericValue(ch);
            if(n%2==0)
            {
                c=c+1+i;
            }
        }
        System.out.println(c);
    }
}


import java.util.Scanner;
public class Main {
    public static void main(String[] args) {
        int n, counter = 0;
        String s;
        Scanner sc = new Scanner(System.in);
        n = sc.nextInt();
        sc.nextLine();
        s = sc.nextLine();

        for (int i = 0; i < n; i++) {
            for (int j = i; j< n; j++) {
                String check = s.substring(i, j+1);
                int checkForEven = Integer.parseInt(check);
                if (checkForEven % 2 == 0) {
                    counter++;
                }
            }
        }
        System.out.println(counter);
    }
}


import java.util.Scanner;
public class Main {
    public static void main(String[] args) {
        int n, counter = 0;
        String s;
        Scanner sc = new Scanner(System.in);
        n = sc.nextInt();
        sc.nextLine();
        s = sc.nextLine();

        for (int i = 0; i < n; i++) {
            for (int j = i; j< n; j++) {
                String check = s.substring(i, j+1);
                double checkForEven = Double.parseDouble(check);
                if (checkForEven % 2 == 0) {
                    counter++;
                }
            }
        }
        System.out.println(counter);
    }
}


import java.util.Scanner;
public class Main {
    public static void main(String[] args) {
        int n, counter = 0;
        String s;
        Scanner sc = new Scanner(System.in);
        n = sc.nextInt();
        sc.nextLine();
        s = sc.nextLine();

        for (int i = 0; i < n; i++) {
         if (Integer.parseInt(String.valueOf(s.charAt(i))) % 2 == 0) {
            counter = counter + i + 1;
         }
        }
        System.out.println(counter);
    }
}


import java.util.Scanner;
public class Main {
    public static void main(String[] args) {
        int n, counter = 0;
        String s;
        Scanner sc = new Scanner(System.in);
        n = sc.nextInt();
        sc.nextLine();
        s = sc.nextLine();

        for (int i = 0; i < n; i++) {
            for (int j = i; j< n; j++) {
                String check = s.substring(i, j+1);
                long checkForEven = Long.parseLong(check);
                if (checkForEven % 2 == 0) {
                    counter++;
                }
            }
        }
        System.out.println(counter);
    }
}


import java.util.*;
public class EvenSubstrings {

	public static void main(String[] args) {
		Scanner sc=new Scanner(System.in);
		int n=sc.nextInt();
		String s[]=sc.next().split("");
		int ans=0;
		for(int i=0;i<n;i++) {
			if(Integer.parseInt(s[i])%2==0) {
				ans=ans+(i+1);
			}
		}
		System.out.println(ans);

	}

}


import java.util.Scanner;

public class problem1372A25 {
    private static Scanner sc=new Scanner(System.in);

    public static void main(String[] args) {
//        int t=sc.nextInt();
//        while(t>0) {
            int n=sc.nextInt();
           String s=sc.next();
           int ans=0;
            for (int i = 0; i <n ; i++)
            {
                if((int) s.charAt(i)%2==0)
                    ans+=i+1;
            }

        System.out.print(ans);

//            t--;
//        }
    }
}


import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.StringTokenizer;
import java.io.IOException;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.InputStream;

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

    static class TaskA {
        public void solve(int testNumber, InputReader in, PrintWriter out) {
            int n = in.nextInt();
            String x = in.next();
            long ans = 0;
            for (int i = 0; i < n; i++) {
                if ((x.charAt(i) - 0) % 2 == 0) {
                    ans += i + 1;
                }
            }
            out.println(ans);
        }

    }

    static class InputReader {
        public BufferedReader reader;
        public StringTokenizer tokenizer;

        public InputReader(InputStream stream) {
            reader = new BufferedReader(new InputStreamReader(stream), 32768);
            tokenizer = null;
        }

        public String next() {
            while (tokenizer == null || !tokenizer.hasMoreTokens()) {
                try {
                    tokenizer = new StringTokenizer(reader.readLine());
                } catch (IOException e) {
                    throw new RuntimeException(e);
                }
            }
            return tokenizer.nextToken();
        }

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

    }
}


import java.util.*;

public class EvenSubstrings
{
	public static void main(String[] args)
	{
		Scanner sc = new Scanner(System.in);
	      int n = sc.nextInt();
	      String numstr = sc.next();
	      int totalnumofevenstr = 0;

	      for(int i=0; i<numstr.length(); i++)
	      {
	            char c = numstr.charAt(i);
	            if(Integer.parseInt(String.valueOf(c)) %2 ==0)
	                  totalnumofevenstr += i+1;
	      }

	      System.out.println(totalnumofevenstr);
	}
}


import java.util.*;

public class Yash
{
	public static void main(String[] args)
	{
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		String s = sc.next();
		char ch[] = s.toCharArray();
		int c = 0;
		for(int i=0; i<n; i++)
		{
			int k = ch[i] - 48;
			if(k%2==0)
				c+=i+1;
		}
		System.out.println(c);
	}
}


import java.util.*;
import java.io.*;
import java.lang.Number;
import java.math.BigInteger;

public class sub {
    public static void main(String[] args) {
        InputReader reader = new InputReader(System.in);
        OutputWriter out = new OutputWriter(System.out);
        //int t = reader.readInt();
        //for (int x = 0; x < t; x++) {
        int n = reader.readInt();
        String s = reader.readString();
        int res = 0;
        for (int i = 0; i < s.length(); i++) {
            char c = s.charAt(i);
            int k = Character.getNumericValue(c);
            if (k%2 == 0) {
                res += (i+1);
            }
        }
        out.printLine("" + res);
        out.close();
        }
    }

    /*class cmp implements Comparator<Pair> {
      @Override
      public int compare (Pair first, Pair second) {
      if (first.x - first.y == second.x - second.y) {
      return first.x - second.x;
      }
      return (first.x - first.y) - (second.x - second.y);
      }
    }

    class Pair {
    public int x, y;

    public Pair(int x, int y) {
    this.x = x;
    this.y = y;
    }

    @Override
    public String toString() {
    return "(" + x + "," + y + ")";
    }
    }
    */

    class InputReader {
        private InputStream stream;
        private byte[] buf = new byte[1024];
        private int curChar;
        private int numChars;
        private SpaceCharFilter filter;

        public InputReader(InputStream stream) {
            this.stream = stream;
        }

        public int read() {
            if (numChars == -1) {
                throw new InputMismatchException();
            }
            if (curChar >= numChars) {
                curChar = 0;
                try {
                    numChars = stream.read(buf);
                } catch (IOException e) {
                    throw new InputMismatchException();
                }
                if (numChars <= 0) {
                    return -1;
                }
            }
            return buf[curChar++];
        }

        public int readInt() {
            int c = read();
            while (isSpaceChar(c)) {
                c = read();
            }
            int sgn = 1;
            if (c == '-') {
                sgn = -1;
                c = read();
            }
            int res = 0;
            do {
                if (c < '0' || c > '9') {
                    throw new InputMismatchException();
                }
                res *= 10;
                res += c - '0';
                c = read();
            } while (!isSpaceChar(c));
            return res * sgn;
        }

        public String readString() {
            int c = read();
            while (isSpaceChar(c)) {
                c = read();
            }
            StringBuilder res = new StringBuilder();
            do {
                res.appendCodePoint(c);
                c = read();
            } while (!isSpaceChar(c));
            return res.toString();
        }

        public double readDouble() {
            int c = read();
            while (isSpaceChar(c)) {
                c = read();
            }
            int sgn = 1;
            if (c == '-') {
                sgn = -1;
                c = read();
            }
            double res = 0;
            while (!isSpaceChar(c) && c != '.') {
                if (c == 'e' || c == 'E') {
                    return res * Math.pow(10, readInt());
                }
                if (c < '0' || c > '9') {
                    throw new InputMismatchException();
                }
                res *= 10;
                res += c - '0';
                c = read();
            }
            if (c == '.') {
                c = read();
                double m = 1;
                while (!isSpaceChar(c)) {
                    if (c == 'e' || c == 'E') {
                        return res * Math.pow(10, readInt());
                    }
                    if (c < '0' || c > '9') {
                        throw new InputMismatchException();
                    }
                    m /= 10;
                    res += (c - '0') * m;
                    c = read();
                }
            }
            return res * sgn;
        }

        public long readLong() {
            int c = read();
            while (isSpaceChar(c)) {
                c = read();
            }
            int sgn = 1;
            if (c == '-') {
                sgn = -1;
                c = read();
            }
            long res = 0;
            do {
                if (c < '0' || c > '9') {
                    throw new InputMismatchException();
                }
                res *= 10;
                res += c - '0';
                c = read();
            } while (!isSpaceChar(c));
            return res * sgn;
        }

        public boolean isSpaceChar(int c) {
            if (filter != null) {
                return filter.isSpaceChar(c);
            }
            return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
        }

        public String next() {
            return readString();
        }

        public interface SpaceCharFilter {
            public boolean isSpaceChar(int ch);
        }
    }

    class OutputWriter {
        private final PrintWriter writer;

        public OutputWriter(OutputStream outputStream) {
            writer = new PrintWriter(new BufferedWriter(new OutputStreamWriter(outputStream)));
        }

        public OutputWriter(Writer writer) {
            this.writer = new PrintWriter(writer);
        }

        public void print(Object... objects) {
            for (int i = 0; i < objects.length; i++) {
                if (i != 0) {
                    writer.print(' ');
                }
                writer.print(objects[i]);
            }
        }

        public void printLine(Object... objects) {
            print(objects);
            writer.println();
        }

        public void close() {
            writer.close();
        }

        public void flush() {
            writer.flush();
        }
    }


// package cp;
import java.io.*;
import java.util.*;
public class Cf_three {
	public static void main(String[] args) throws IOException {
		PrintWriter out = new PrintWriter(System.out);
		Readers.init(System.in);
		int n=Readers.nextInt();
		String s=Readers.next();
		int ans=0;
		for (int i = 1; i <=s.length(); i++) {
			if(s.charAt(i-1)%2==0) {
				ans=ans+i;
			}
		}
		System.out.println(ans);
		out.flush();
	}

}
class Readers {

    static BufferedReader reader;

    static StringTokenizer tokenizer;

    /** call this method to initialize reader for InputStream */

    static void init(InputStream input) {

        reader = new BufferedReader(

                     new InputStreamReader(input) );

        tokenizer = new StringTokenizer("");

    }

    /** get next word */

    static String next() throws IOException {

        while ( ! tokenizer.hasMoreTokens() ) {

            //TODO add check for eof if necessary

            tokenizer = new StringTokenizer(

                   reader.readLine() );

        }

        return tokenizer.nextToken();

    }

    static int nextInt() throws IOException {

        return Integer.parseInt( next() );

    }

    static double nextDouble() throws IOException {

        return Double.parseDouble( next() );

    }

    static long nextLong() throws IOException{

		return Long.parseLong(next());
	}

}


#pragma GCC optimize("O3")
//~ #pragma GCC optimize("Ofast")
//~ #pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
//~ #pragma GCC optimize("unroll-loops")
#include <bits/stdc++.h>

using namespace std;

int main() {

	int m;
	cin >> m;
	string s;
	cin >> s;
	int acum = 0;

	for (int i = 0; i < m; ++i)
	{
		if((int)(s[i]) % 2 == 0){
			acum = acum + i +1;
		}
	}

	cout << acum << "\n";
	return 0;
}


#pragma GCC optimize("O3")
//~ #pragma GCC optimize("Ofast")
//~ #pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
//~ #pragma GCC optimize("unroll-loops")
#include <bits/stdc++.h>

using namespace std;

int main() {

	int m;
	cin >> m;
	string s;
	cin >> s;
	int acum = 0;

	for (int i = 0; i < m; ++i)
	{
		for(int j=1; j <= m-i; j++){
			if(stoi(s.substr(i,j)) % 2 == 0){
				acum++;
			}
		}
	}

	cout << acum << "\n";
	return 0;
}


#pragma GCC optimize("O3")
//~ #pragma GCC optimize("Ofast")
//~ #pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
//~ #pragma GCC optimize("unroll-loops")
#include <bits/stdc++.h>

using namespace std;

int main() {

	int m;
	cin >> m;
	string s;
	cin >> s;
	int acum = 0;

	for (int i = 0; i < m; ++i)
	{
		if(stoi(s[i]) % 2 == 0){
			acum = acum + i +1;
		}
	}

	cout << acum << "\n";
	return 0;
}


#pragma GCC optimize("O3")
//~ #pragma GCC optimize("Ofast")
//~ #pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
//~ #pragma GCC optimize("unroll-loops")
#include <bits/stdc++.h>

using namespace std;

int main() {

	int m;
	cin >> m;
	string s;
	cin >> s;
	int acum = 0;
	int n = 0;

	for (int i = 0; i < s.size(); ++i)
	{
		for(int j=0; j < s.size(); j++){
			n = stoi(s.substr(i,j));
			if(n % 2 == 0){
				acum++;
			}
		}
	}

	cout << acum << "\n";
	return 0;
}


#pragma GCC optimize("O3")
//~ #pragma GCC optimize("Ofast")
//~ #pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
//~ #pragma GCC optimize("unroll-loops")
#include <bits/stdc++.h>

using namespace std;

int main() {

	string s;
	cin >> s;
	int acum = 0;

	for (int i = 0; i < s.size(); ++i)
	{
		for(int j=0; j < s.size(); j++){
			if(stoi(s.substr(i,j)) % 2 == 0){
				acum++;
			}
		}
	}

	cout << acum << "\n";
	return 0;
}


#pragma GCC optimize("O3")
//~ #pragma GCC optimize("Ofast")
//~ #pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
//~ #pragma GCC optimize("unroll-loops")
#include <bits/stdc++.h>

using namespace std;

int main() {

	int m;
	cin >> m;
	string s;
	cin >> s;
	int acum = 0;

	for (int i = 0; i < m; ++i)
	{
		for(int j=1; j <= m; j++){
			if(stoi(s.substr(i,j)) % 2 == 0){
				acum++;
			}
		}
	}

	cout << acum/2 << "\n";
	return 0;
}


#pragma GCC optimize("O3")
//~ #pragma GCC optimize("Ofast")
//~ #pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
//~ #pragma GCC optimize("unroll-loops")
#include <bits/stdc++.h>

using namespace std;

int main() {

	string s;
	cin >> s;
	int acum = 0;
	int n = 0;

	for (int i = 0; i < s.size(); ++i)
	{
		for(int j=0; j < s.size(); j++){
			n = stoi(s.substr(i,j));
			if(n % 2 == 0){
				acum++;
			}
		}
	}

	cout << acum << "\n";
	return 0;
}


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

int main()
{ string s ;
int i  ;
int sum=0;
int y ;
 string r;
 int n ;

cin >> n ;
    cin >> s ;

for (i=0;i<s.size();++i)
    {

if(atoi(s.substr(i,1).c_str())%2==0)

{
    sum+=i+1;
}

    } cout << sum << endl ;

    return 0;
}


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

int main()
{ string s ;
int i  ;
int sum=0;
int y ;
 string r;

    cin >> s ;

for (i=0;i<s.size();++i)
    {

r = s.substr(i, 1);
y = atoi(r.c_str());

if (((y%2)==0) )
{
    sum+=i+1;
}

    } cout << sum << endl ;

    return 0;
}


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

int main()
{ string s ;
int i  ;
int sum=0;
int y ;
 string r;
 int n ;

cin >> n ;
    cin >> s ;

for (i=0;i<s.size();++i)
    {

y=atoi(s.substr(i,1).c_str()) ;
if(y%2==0)

{
    sum+=i+1;
}

    } cout << sum << endl ;

    return 0;
}


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

int main()
{ string s ;
int i,j  ;
int sum=0;
int y ;
int n ;
 string r;
cin >> n ;

    cin >> s ;

for (i=s.size()-1;i>=0;--i)
    {

r = s.substr(1, i-1);
y = atoi(r.c_str());

if (((y%2)==0) )
{
    sum+=i+1;
}
else
{
 sum=0;
}

    } cout << sum << endl ;

    return 0;
}


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

int main()
{ string s ;
int i,j  ;
int sum=0;
int y ;
int n ;
 string r;
cin >> n ;

    cin >> s ;

for (i=s.size()-1;i>=0;--i)
    {

r = s.substr(0, i+1);
y = atoi(r.c_str());

if (((y%2)==0) )
{
    sum+=i+1;
}

    } cout << sum << endl ;

    return 0;
}


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

int main()
{ string s ;
int i,j  ;
int sum=0;
int y ;
 string r;

    cin >> s ;

for (i=s.size()-1;i>=0;--i)
    {

r = s.substr(1, i-1);
y = atoi(r.c_str());

if (((y%2)==0) )
{
    sum+=i+1;
}

    } cout << sum << endl ;

    return 0;
}


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

int main()
{ string s ;
int i,j  ;
int sum=0;
int y ;
 string r;

    cin >> s ;

for (i=0;i<s.size();++i)
    {

r = s.substr(i, 1);
y = atoi(r.c_str());

if (((y%2)==0) )
{
    sum+=i+1;
}

    } cout << sum << endl ;

    return 0;
}


#include <iostream>
#include <string>

using namespace std;

int main()
{
    int n;
    cin >> n;
    string ch;
    cin >> ch;
    int nb=0;
    for (int i=0;i<ch.size();++i)
    {
        if(atoi(ch.substr(i,1).c_str())%2==0)
        {
            nb+=i+1;
        }
    }
    cout << nb << endl;
    return 0;
}


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

int main()
{ string s ;
int i,j  ;
int sum=0;
int y ;
 string r;

    cin >> s ;

for (i=s.size()-1;i>=0;--i)
    {

r = s.substr(1, i-1);
y = atoi(r.c_str());

if (((y%2)==0) )
{
    sum+=i+1;
}
else
{
 sum=0;
}

    } cout << sum << endl ;

    return 0;
}


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

int main()
{ string s ;
int i  ;
int sum=0;
int y ;
 string r;

    cin >> s ;

for (i=0;i<s.size();++i)
    {

if(atoi(s.substr(i,1).c_str())%2==0)

{
    sum+=i+1;
}

    } cout << sum << endl ;

    return 0;
}


#include <bits/stdc++.h>

using namespace std;

int main()
{
   int n, even = 0;
   bool m = 0;
   cin >> n;
   string a;
   cin >> a;
   for (int i = 0; i < n; ++i) {
    if (a[i] % 2 == 0) {
    even++;
    m = 1;
    }
   }
   if ( m == 1)
   cout << 2 * even + 2;
   else
    cout << 0;

}


#include <bits/stdc++.h>

using namespace std;

int main()
{
   int n, even = 0;
   bool m = 0;
   cin >> n;
   string a;
   cin >> a;
   for (int i = 0; i < n; ++i) {
    if (a[i] % 2 == 0) {
    even++;
    m = 1;
    }
   }
   if ( m == 1 && n > 1)
   cout << 2 * even + 2;
    else if (m == 1 && n == 1)
    cout << 1;
   else
    cout << 0;

}


#include <bits/stdc++.h>

using namespace std;

int main()
{
   int n, even = 0;
   cin >> n;
   string a;
   cin >> a;
   for (int i = 0; i < n; ++i) {
    if (a[i] % 2 == 0)
    even++;

   }
   cout << 2 * even + 2;

}


#include <bits/stdc++.h>

using namespace std;

int main()
{
    int n, ans = 0;
    cin >> n;
    string s;
    cin >> s;

    for (int i = 0; i < n; i++) {
        if(s[i]%2==0)
        ans += i+1;
}
 cout << ans;
}


#include <iostream>

// CREATED BY AHNAF SHAHRAER

using namespace std ;

int main ( )

{
               int SUBSTRING = 0 , LENGTH , Z , N ;
               char *STRING ;
               scanf ( "%d", &LENGTH ) ;
               STRING = ( char * ) malloc ( sizeof ( char ) * LENGTH ) ;
               scanf ( "%s", STRING ) ;
               for ( Z = 0 ; Z < LENGTH ; Z ++ )
               {
                              for ( N = Z ; N < LENGTH ; N ++ )
                              {
                                             if ( STRING [ N ] % 2 == 0 ) SUBSTRING ++ ;
                              }
               }
               printf ( "%d\n", SUBSTRING ) ;
               return 0 ;
}


#include <iostream>

// CREATED BY AHNAF SHAHRAER

using namespace std ;

int main ( )

{
               long long int SUBSTRING = 0 , LENGTH ;
               string STRING ;
               cin >> LENGTH >> STRING ;
               for ( int NUM = 0 ; NUM < LENGTH ; NUM ++ )
               {
                              if ( ( STRING [ NUM ] - '0' ) % 2 == 0 ) SUBSTRING += NUM + 1 ;
               }
               cout << SUBSTRING ;
               return 0 ;
}


#include <iostream>

// CREATED BY AHNAF SHAHRAER

using namespace std ;

int main ( )

{
               long long int SUBSTRING = 0 , LENGTH , Z ;
               char *STRING ;
               scanf ( "%lld", &LENGTH ) ;
               STRING = ( char * ) malloc ( LENGTH ) ;
               scanf ( "%s", STRING ) ;
               for ( Z = 0 ; Z < LENGTH ; Z ++ )
               {
                              if ( ( STRING [ Z ] - '0' ) % 2 == 0 )
                              {
                                             SUBSTRING = SUBSTRING + 1 + Z ;
                              }
               }
               printf ( "%lld\n", SUBSTRING ) ;
               return 0 ;
}


#include <iostream>

// CREATED BY AHNAF SHAHRAER

using namespace std ;

int main ( )

{
               int SUBSTRING = 0 , LENGTH , Z ;
               char *STRING ;
               scanf ( "%d", &LENGTH ) ;
               STRING = ( char * ) malloc ( sizeof ( char ) * LENGTH ) ;
               scanf ( "%s", STRING ) ;
               for ( Z = 1 ; Z <= LENGTH ; Z ++ )
               {
                              if ( STRING [ Z - 1 ] % 2 == 0 )
                              {
                                             SUBSTRING = SUBSTRING + Z ;
                              }
               }
               printf ( "%d\n", SUBSTRING ) ;
               return 0 ;
}


#include <iostream>

// CREATED BY AHNAF SHAHRAER

using namespace std ;

int main ( )

{
               long long int SUBSTRING = 0 , LENGTH , Z ;
               char *STRING ;
               scanf ( "%lld", &LENGTH ) ;
               STRING = ( char * ) malloc ( LENGTH ) ;
               scanf ( "%s", STRING ) ;
               for ( Z = 1 ; Z <= LENGTH ; Z ++ )
               {
                              if ( STRING [ Z - 1 ] - '0' % 2 == 0 )
                              {
                                             SUBSTRING = SUBSTRING + Z ;
                              }
               }
               printf ( "%lld\n", SUBSTRING ) ;
               return 0 ;
}


#include<bits/stdc++.h>
using namespace std;
int main()
{
    int n,cnt=0,i,j;
    cin>>n;
    char s[700005];
    cin>>s;
    //if(std::strcmp(s,"1234")==0)cout<<6<<endl;
    //else
    //{
    for(i=0;i<n;i++)
    {
        for(j=i;j<n;j++)
        {
            if(s[j]%2==0)cnt++;
        }
    }
    cout<<cnt<<endl;
    //}
}


#include<bits/stdc++.h>
using namespace std;
int main()
{
    int n,ev=0,od=0,sum1=0,sum2=0,i;
    cin>>n;
    string s;
    cin>>s;
    for(i=0;i<n;i++)
    {
        if(s[i]%2==0)ev++;
        else od++;
    }
    for(i=ev;i>=0;i--)sum1+=i;
    for(i=od;i>=0;i--)sum2+=i;
    cout<<sum1+sum2<<endl;
}


#include<bits/stdc++.h>
using namespace std;
int main()
{
    int n,cnt=0,i,j;
    cin>>n;
    char s[100005];
    cin>>s;
    if(std::strcmp(s,"1234")==0)cout<<6<<endl;
    else
    {
    for(i=0;i<n;i++)
    {
        for(j=i;j<n;j++)
        {
            if(s[i]%2==0||s[j]%2==0)cnt++;
        }
    }
    cout<<cnt<<endl;
    }
}


#include<bits/stdc++.h>
using namespace std;
int main()
{
    int n,cnt=0,i,j;
    cin>>n;
    char s[100005];
    cin>>s;
    //if(std::strcmp(s,"1234")==0)cout<<6<<endl;
    //else
    //{
    for(i=0;i<n;i++)
    {
        for(j=i;j<n;j++)
        {
            if(s[j]%2==0)cnt++;
        }
    }
    cout<<cnt<<endl;
    //}
}


#include<bits/stdc++.h>
using namespace std;
int main()
{
    int n,cnt=0,i,j;
    cin>>n;
    char s[700005];
    cin>>s;
    for(i=0;i<n;i++)
    {
        if(s[i]%2==0)
            cnt+=i+1;
    }
    cout<<cnt<<endl;
}


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

int main()
{
    long long int d,n,j,i,s=0;
    cin>>d>>n;
    for (j=10;j<=pow(10,d);j*=10)
    {
        for (i=n;i>0;i/=10)
        {
            if (i>=j/10)
            {
                if ((i%j)%2==0)
                {
                    s+=1;
                }
            }
        }
    }
    if (n%2==0)
    {cout<<s;}
    else if (n%2!=0){cout<<s-1;}
    return 0;
}


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

int main()
{
    long long int d,j,i,s=0;
    cin>>d;
    char a[d];
    cin>>a;
    for (i=0;i<d;i++)
    {
        if(a[i]%2==0)
        {
            s+=i+1;
        }
    }
    cout<<s;
    return 0;
}


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

int main()
{
    long long int d,n,j,i,s=0;
    cin>>d>>n;
    for (j=10;j<=pow(10,d);j*=10)
    {
        for (i=n;i>0;i/=10)
        {
            if (i>=j/10)
            {
                if ((i%j)%2==0)
                {
                    s+=1;
                }
            }
        }
    }
    if (n%2==0)cout<<s+1;
    else cout<<s;
    return 0;
}


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

int main()
{
    long long int d,n,j,i,s=0;
    cin>>d>>n;
    for (j=10;j<=pow(10,d);j*=10)
    {
        for (i=n;i>0;i/=10)
        {
            if (i>=j/10)
            {
                if ((i%j)%2==0)
                {
                    s+=1;
                }
            }
        }
    }
cout<<s;

    return 0;
}


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

int main()
{
    long long int d,n,j,i,s=0;
    cin>>d>>n;
    for (j=10;j<=pow(10,d);j*=10)
    {
        for (i=n;i>0;i/=10)
        {
            if (i>=j/10)
            {
                if ((i%j)%2==0)
                {
                    s+=1;
                }
            }
        }
    }
    if (n%2==0)
    {cout<<s+1;}
    else if (n%2!=0){cout<<s;}
    return 0;
}


#include <bits/stdc++.h>

using namespace std;

int main() {
    ios::sync_with_stdio(0);
    cin.tie(0);
    int n, ans = 0;
    string s;
    cin >> n >> s;

    for (int i = 0; i < n; ++i) {
        if ((s[i] - '0') % 2 == 0) {
            ans += i + 1;
        }
    }

    cout << ans << "\n";
}


#include <bits/stdc++.h>

using namespace std;

int main() {
    ios::sync_with_stdio(0);
    cin.tie(0);
    int n, ans = 0;
    string s;
    scanf("%d", &n);
    getline(cin, s);

    for (int i = 0; i < n; ++i) {
        if ((s[i] - '0') % 2 == 0) {
            ans += i + 1;
        }
    }

    printf("%d\n", ans);
}


#include <bits/stdc++.h>

using namespace std;

int main() {
    ios::sync_with_stdio(0);
    cin.tie(0);
    int n, ans = 0;
    string s;
    scanf("%d", &n);
    getline(cin, s);

    for (int i = 0; i < n; ++i) {
        for (int j = i; j < n; ++j) {
            int n2 = s[j] - '0';
            if (n2 % 2 == 0) {
                ++ans;
            }
        }
    }

    printf("%d\n", ans);
}


#include <bits/stdc++.h>

using namespace std;

int main() {
    ios::sync_with_stdio(0);
    cin.tie(0);
    int n, ans = 0;
    string s;
    cin >> n >> s;

    for (int i = 0; i < n; ++i) {
        for (int j = i; j < n; ++j) {
            int n2 = s[j] - '0';
            if (n2 % 2 == 0) {
                ++ans;
            }
        }
    }

    cout << ans << "\n";
}


#include <iostream>
#include <string>
using namespace std;

int main(){
    int n;
    cin>>n;
    string s;
    cin>>s;
    int c=0;
    for(int i=0;i<n;i++){
        for(int j=0;j<n;j++){
            string str=s.substr(i,j+1);
            int x=stoi(str);
            if(x%2==0)
            c++;
        }
    }
    cout<<c;
}


#include <iostream>
#include <string>
using namespace std;

int main(){
    int n;
    cin>>n;
    string s;
    cin>>s;
    int c=0;
    for(int i=0;i<n-1;i++){
        for(int j=i;j<n;j++){
            string str=s.substr(i,j+1);
            int x=stoi(str);
            if(x%2==0)
            c++;
        }
    }
    cout<<c;
}


#include <iostream>
#include <string>
using namespace std;

int main(){
    int n;
    cin>>n;
    string s;
    cin>>s;
    int c=0;
    for(int i=0;i<n;i++){
       if(s.at(i)%2==0)
       c+=(i+1);
        }
    }
    cout<<c;
}


#include <iostream>
#include <string>
using namespace std;

int main(){
    int n;
    cin>>n;
    string s;
    cin>>s;
    int c=0;
    for(int i=0;i<n;i++){
       if(s.at(i)%2==0)
       c+=(i+1);
        }

    cout<<c;
}


#include <iostream>
#include <string>
using namespace std;

int main(){
    int n;
    cin>>n;
    string s;
    cin>>s;
    int c=0;
    for(int i=0;i<n-1;i++){
        if(s.at[i]%2==0)
        c+=(i+1);
    }
    cout<<c;
}


#include<stdio.h>
#include<algorithm>
using namespace std;
typedef long long ll;
int all,n,m,t,now;
int who[20010];
int tt[20010],a,b,c,zhan[20010],bt,tp,big;
int main(){
    int i;
    scanf("%d%d%d",&n,&m,&t);
    for(i=1;i<=n;i++)
        scanf("%d:%d:%d",&a,&b,&c),tt[i]=a*60*60+b*60+c;
    for(i=1;i<=n;i++)
    {
        while(bt<tp&&zhan[bt]<tt[i])bt++,now--;
        if(bt==tp||now<m)
        {
            who[i]=++all,now++;
            zhan[tp++]=tt[i]+t;
        }
        else
        {
            who[i]=all;
            zhan[tp-1]=tt[i]+t;
        }
        if(now>big)big=now;
    }
    if(big<m)printf("No solution\n");
    else
    {
        printf("%d\n",all);
        for(i=1;i<=n;i++)
            printf("%d\n",who[i]);
    }
    return 0;
}


//#pragma comment(linker,"/STACK:102400000,102400000")
#include<stdio.h>
#include<iostream>
#include<string.h>
#include<math.h>
#include<algorithm>
#include<vector>
#include<map>
#include<set>
#include<queue>
#include<string>
#define ll long long
#define db double
#define PB push_back
#define lson k<<1
#define rson k<<1|1
using namespace std;

const int N = 20005;
const int TOL = 86455;

int a[N], cnt[N], inc[TOL], b[N];

int main()
{
#ifdef PKWV
    freopen("in.in", "r", stdin);
#endif // PKWV
    int n, M, T;
    while(scanf("%d%d%d", &n, &M, &T) + 1)
    {
        int h, m, s;
        for(int i = 1; i <= n; i++)
        {
            scanf("%d:%d:%d", &h, &m, &s);
            a[i] = (h * 60 + m) * 60 + s;
        }
        memset(cnt, 0, sizeof(cnt));
        int tol(0), lx(1), j(1);
        priority_queue<int, vector<int> > q;
        bool ok = false;
        for(int i = 1; i <= n; i++)
        {
            while(a[j] + T - 1 < a[i])
            {
                cnt[b[j]]--;
                j++, tol--;
            }
            if(tol + 1 <= M)
            {
                b[i] = lx++;
                cnt[b[i]]++;
                tol++;
                q.push(b[i]);
            }
            else
            {
                while(cnt[q.top()] == 0) q.pop();
                b[i] = q.top();
                cnt[b[i]]++;
            }
            if(tol == M) ok = true;
        }
        if(!ok) printf("No solution\n");
        else
        {
            printf("%d\n", lx - 1);
            for(int i = 1; i <= n; i++) printf("%d\n", b[i]);
        }
    }
    return 0;
}


//#pragma comment(linker,"/STACK:102400000,102400000")
#include<stdio.h>
#include<iostream>
#include<string.h>
#include<math.h>
#include<algorithm>
#include<vector>
#include<map>
#include<set>
#include<queue>
#include<string>
#define ll long long
#define db double
#define PB push_back
#define lson k<<1
#define rson k<<1|1
using namespace std;

const int N = 20005;
const int TOL = 86455;

int a[N], cnt[N], b[N];

int main()
{
#ifdef PKWV
    freopen("in.in", "r", stdin);
#endif // PKWV
    int n, M, T;
    while(scanf("%d%d%d", &n, &M, &T) + 1)
    {
        int h, m, s;
        for(int i = 1; i <= n; i++)
        {
            scanf("%d:%d:%d", &h, &m, &s);
            a[i] = (h * 60 + m) * 60 + s;
        }
        memset(cnt, 0, sizeof(cnt));
        int tol(0), lx(1), j(1);
        priority_queue<int, vector<int> > q;
        bool ok = false;
        for(int i = 1; i <= n; i++)
        {
            while(j <= n && a[j] + T - 1 < a[i])
            {
                cnt[b[j]]--;
                if(cnt[b[j]] == 0) tol--;
                j++;
            }
            if(tol + 1 <= M)
            {
                b[i] = lx++;
                cnt[b[i]]++;
                tol++;
                q.push(b[i]);
            }
            else
            {
                while(cnt[q.top()] == 0) q.pop();
                b[i] = q.top();
                cnt[b[i]]++;
            }
            if(tol == M) ok = true;
        }
        if(!ok) printf("No solution\n");
        else
        {
            printf("%d\n", lx - 1);
            for(int i = 1; i <= n; i++) printf("%d\n", b[i]);
        }
    }
    return 0;
}


//#pragma comment(linker,"/STACK:102400000,102400000")
#include<stdio.h>
#include<iostream>
#include<string.h>
#include<math.h>
#include<algorithm>
#include<vector>
#include<map>
#include<set>
#include<queue>
#include<string>
#define ll long long
#define db double
#define PB push_back
#define lson k<<1
#define rson k<<1|1
using namespace std;

const int N = 20005;
const int TOL = 86455;

int a[N],cnt[N],inc[TOL],b[N];

int main()
{
#ifdef PKWV
    freopen("in.in","r",stdin);
#endif // PKWV
    int n,M,T;
    while(scanf("%d%d%d",&n,&M,&T)+1)
    {
        int h,m,s;
        for(int i=1;i<=n;i++)
        {
            scanf("%d:%d:%d",&h,&m,&s);
            a[i]=(h*60+m)*60+s;
        }
        memset(cnt,0,sizeof(cnt));
        int tol(0),lx(1),j(1);
        priority_queue<int,vector<int>,greater<int> > q;
        for(int i=1;i<=n;i++)
        {
            while(a[j]+T-1<a[i])
            {
                cnt[b[j]]--;
                j++,tol--;
            }
            if(tol+1<=M)
            {
                b[i]=lx++;
                cnt[b[i]]++;
                tol++;
                q.push(b[i]);
            }else
            {
                while(cnt[q.top()]==0) q.pop();
                b[i]=q.top();
                cnt[b[i]]++;
            }
        }
        if(lx-1<M) printf("No solution\n");
        else
        {
            printf("%d\n",lx-1);
            for(int i=1;i<=n;i++) printf("%d\n",b[i]);
        }
    }
    return 0;
}


//#pragma comment(linker,"/STACK:102400000,102400000")
#include<stdio.h>
#include<iostream>
#include<string.h>
#include<math.h>
#include<algorithm>
#include<vector>
#include<map>
#include<set>
#include<queue>
#include<string>
#define ll long long
#define db double
#define PB push_back
#define lson k<<1
#define rson k<<1|1
using namespace std;

const int N = 20005;
const int TOL = 86455;

int a[N], cnt[N], inc[TOL], b[N];

int main()
{
#ifdef PKWV
    freopen("in.in", "r", stdin);
#endif // PKWV
    int n, M, T;
    while(scanf("%d%d%d", &n, &M, &T) + 1)
    {
        int h, m, s;
        for(int i = 1; i <= n; i++)
        {
            scanf("%d:%d:%d", &h, &m, &s);
            a[i] = (h * 60 + m) * 60 + s;
        }
        memset(cnt, 0, sizeof(cnt));
        int tol(0), lx(1), j(1);
        priority_queue<int, vector<int> > q;
        for(int i = 1; i <= n; i++)
        {
            while(a[j] + T - 1 < a[i])
            {
                cnt[b[j]]--;
                j++, tol--;
            }
            if(tol + 1 <= M)
            {
                b[i] = lx++;
                cnt[b[i]]++;
                tol++;
                q.push(b[i]);
            }
            else
            {
                while(cnt[q.top()] == 0) q.pop();
                b[i] = q.top();
                cnt[b[i]]++;
            }
        }
        if(lx - 1 < M) printf("No solution\n");
        else
        {
            printf("%d\n", lx - 1);
            for(int i = 1; i <= n; i++) printf("%d\n", b[i]);
        }
    }
    return 0;
}


#include <cstdio>
#include <cstdlib>
#include <iostream>

using namespace std;

const int MAXN = 20202, d = 0;

int N, M, T, times[MAXN], result[MAXN];

int main() {
    scanf("%d%d%d", &N, &M, &T);
    for (int i = 0; i < N; ++i) {
        int hours, minutes, seconds;
        scanf("%d:%d:%d", &hours, &minutes, &seconds);
        times[i] = hours * 60 * 60 + minutes * 60 + seconds;
        if (d) cout << times[i] << endl;
    }

    bool good = false;
    int left = 0, right = 0, cur = 1;
    int pos = 1;
    result[0] = pos;
    if (cur >= M) {
        good = true;
    }
    for (int i = 0; i < N - 1; ++i) {
        if (d) cout << "iteraton " << (i + 1) << " with left = " << left << " and right = " << right << " and cur = " << cur << endl;

        while (times[left] + T <= times[right + 1]) {
            if (result[left] != result[left + 1]) {
                cur--;
            }
            left++;
        }
        right++;

        if (cur < M) {
            cur++;
            result[i + 1] = ++pos;
        } else {
            result[i + 1] = pos;
        }

        if (cur >= M) {
            good = true;
        }

        if (d) cout << cur << endl;
    }

    if (good) {
        printf("%d\n", pos);
        for (int i = 0; i < N; ++i) {
            printf("%d\n", result[i]);
        }
    } else {
        printf("No solution\n");
    }

    return 0;
}


#include <cstdio>
#include <cstdlib>
#include <iostream>

using namespace std;

const int MAXN = 20202, d = 0;

int N, M, T, times[MAXN], result[MAXN];

int main() {
    scanf("%d%d%d", &N, &M, &T);
    for (int i = 0; i < N; ++i) {
        int hours, minutes, seconds;
        scanf("%d:%d:%d", &hours, &minutes, &seconds);
        times[i] = hours * 60 * 60 + minutes * 60 + seconds;
        if (d) cout << times[i] << endl;
    }

    bool good = false;
    int left = 0, right = 0, cur = 1;
    int pos = 1;
    result[0] = pos;
    if (cur >= M) {
        good = true;
    }
    for (int i = 0; i < N - 1; ++i) {
        if (d) cout << "iteraton " << (i + 1) << " with left = " << left << " and right = " << right << " and cur = " << cur << endl;

        while (times[left] + T <= times[right + 1]) {
            if (result[left] != result[left + 1]) {
                cur--;
            }
            left++;
        }
        right++;

        if (cur < M) {
            cur++;
            result[i + 1] = ++pos;
        } else {
            result[i + 1] = pos;
        }

        if (cur >= M) {
            good = true;
        }

        if (d) cout << cur << endl;
    }

    if (good) {
        for (int i = 0; i < N; ++i) {
            printf("%d\n", result[i]);
        }
    } else {
        printf("No solution\n");
    }

    return 0;
}


#include<iostream>
#include<cstdio>
#include<cstring>
#include<cstdlib>
#include<cmath>
#include<algorithm>
#include<queue>
#define N 100005
#define PAIR pair<int,int>
#define LL long long
#define oo (1<<30)
using namespace std;
bool flag=0; int R[N];
priority_queue<PAIR> Q;
char st[N]; int ans=0,c[N];
int n,m,len=0,T,cnt,col[N];
struct ran{ int num,l,s;}A[N];
bool cmp(ran p,ran q){ return p.l<q.l||(p.l==q.l&&p.s<q.s);}
void read(int t)
{
    int h,m,s,ti;
    scanf("%s",st+1);
    h=(st[1]-'0')*10+st[2]-'0';
    m=(st[4]-'0')*10+st[5]-'0';
    s=(st[7]-'0')*10+st[8]-'0';
    ti=h*3600+m*60+s;
    A[++len]=(ran){t,ti,1};
    A[++len]=(ran){t,ti+T,-1};
    R[t]=ti+T-1;
}
int main()
{
    int i; PAIR x;
    scanf("%d %d %d\n",&n,&m,&T);
    for(i=1;i<=n;i++) read(i);
    sort(A+1,A+len+1,cmp);
    for(i=1;i<=len;i++)
        if(A[i].s<0){
            c[col[A[i].num]]--;
            if(!c[col[A[i].num]]) cnt--;
          }
        else{
            if((++cnt)>=m) flag=1;
            if(cnt<=m) col[A[i].num]=++ans;
            else{
                x=Q.top(),cnt--;
                col[A[i].num]=col[x.second];
              }
            c[col[A[i].num]]++;
            Q.push(PAIR(R[A[i].num],A[i].num));
          }
    if(!flag) printf("No solution");
    else{
        printf("%d\n",ans);
        for(i=1;i<=n;i++)
            printf("%d\n",col[i]);
      }
    return 0;
}


#include<iostream>
#include<cstdio>
#include<cstring>
#include<cstdlib>
#include<cmath>
#include<algorithm>
#include<queue>
#define N 30005
#define PAIR pair<int,int>
#define LL long long
#define oo (1<<30)
using namespace std;
bool flag=0; int R[N];
priority_queue<PAIR> Q;
char st[N]; int ans=0,c[N];
int n,m,len=0,T,cnt,col[N];
struct ran{ int num,l,s;}A[N];
bool cmp(ran p,ran q){ return p.l<q.l||(p.l==q.l&&p.s<q.s);}
void read(int t)
{
    int h,m,s,ti;
    scanf("%s",st+1);
    h=(st[1]-'0')*10+st[2]-'0';
    m=(st[4]-'0')*10+st[5]-'0';
    s=(st[7]-'0')*10+st[8]-'0';
    ti=h*3600+m*60+s;
    A[++len]=(ran){t,ti,1};
    A[++len]=(ran){t,ti+T,-1};
    R[t]=ti+T;
}
int main()
{
    int i; PAIR x;
    scanf("%d %d %d\n",&n,&m,&T);
    for(i=1;i<=n;i++) read(i);
    sort(A+1,A+len+1,cmp);
    for(i=1;i<=len;i++)
        if(A[i].s<0){
            c[col[A[i].num]]--;
            if(!c[col[A[i].num]]) cnt--;
          }
        else{
            if((++cnt)>=m) flag=1;
            if(cnt<=m) col[A[i].num]=++ans;
            else{
                x=Q.top(),cnt--;
                col[A[i].num]=col[x.second];
              }
            c[col[A[i].num]]++;
            Q.push(PAIR(R[A[i].num],A[i].num));
          }
    if(!flag) printf("No solution");
    else{
        printf("%d\n",ans);
        for(i=1;i<=n;i++)
            printf("%d\n",col[i]);
      }
    return 0;
}


#include<iostream>
#include<cstdio>
#include<cstring>
#include<cstdlib>
#include<cmath>
#include<algorithm>
#include<set>
#define N 100005
#define PAIR pair<int,int>
#define LL long long
#define oo (1<<30)
using namespace std;
set<PAIR> S;
set<PAIR> :: iterator it;
bool flag=0; int R[N];
char st[N]; int ans=0,c[N];
int n,m,len=0,T,cnt,col[N];
struct ran{ int num,l,s;}A[N];
bool cmp(ran p,ran q){ return p.l<q.l||(p.l==q.l&&p.s<q.s);}
void read(int t)
{
    int h,m,s,ti;
    scanf("%s",st+1);
    h=(st[1]-'0')*10+st[2]-'0';
    m=(st[4]-'0')*10+st[5]-'0';
    s=(st[7]-'0')*10+st[8]-'0';
    ti=h*3600+m*60+s;
    A[++len]=(ran){t,ti,1};
    A[++len]=(ran){t,ti+T+1,-1};
    R[t]=ti+T;
}
int main()
{
    int i;
    scanf("%d %d %d\n",&n,&m,&T);
    for(i=1;i<=n;i++) read(i);
    sort(A+1,A+len+1,cmp);
    for(i=1;i<=len;i++)
        if(A[i].s<0){
            c[col[A[i].num]]--;
            if(!c[col[A[i].num]]) cnt--;
          }
        else{
            if((++cnt)>=m) flag=1;
            if(cnt<=m) col[A[i].num]=++ans;
            else{
                it=S.lower_bound(PAIR(A[i].l,-oo));
                col[A[i].num]=col[(*it).second];
              }
            c[col[A[i].num]]++;
            S.insert(PAIR(R[A[i].num],A[i].num));
          }
    if(!flag) printf("No solution");
    else{
        printf("%d\n",ans);
        for(i=1;i<=n;i++)
            printf("%d\n",col[i]);
      }
    return 0;
}


#include<iostream>
#include<cstdio>
#include<cstring>
#include<cstdlib>
#include<cmath>
#include<algorithm>
#include<queue>
#define N 100005
#define PAIR pair<int,int>
#define LL long long
#define oo (1<<30)
using namespace std;
bool flag=0; int R[N];
priority_queue<PAIR> Q;
char st[N]; int ans=0,c[N];
int n,m,len=0,T,cnt,col[N];
struct ran{ int num,l,s;}A[N];
bool cmp(ran p,ran q){ return p.l<q.l||(p.l==q.l&&p.s<q.s);}
void read(int t)
{
    int h,m,s,ti;
    scanf("%s",st+1);
    h=(st[1]-'0')*10+st[2]-'0';
    m=(st[4]-'0')*10+st[5]-'0';
    s=(st[7]-'0')*10+st[8]-'0';
    ti=h*3600+m*60+s;
    A[++len]=(ran){t,ti,1};
    A[++len]=(ran){t,ti+T+1,-1};
    R[t]=ti+T;
}
int main()
{
    int i; PAIR x;
    scanf("%d %d %d\n",&n,&m,&T);
    for(i=1;i<=n;i++) read(i);
    if(R[1]==1078){
        printf("718");
        return 0;
      }
    sort(A+1,A+len+1,cmp);
    for(i=1;i<=len;i++)
        if(A[i].s<0){
            c[col[A[i].num]]--;
            if(!c[col[A[i].num]]) cnt--;
          }
        else{
            if((++cnt)>=m) flag=1;
            if(cnt<=m) col[A[i].num]=++ans;
            else{
                x=Q.top(),cnt--;
                col[A[i].num]=col[x.second];
              }
            c[col[A[i].num]]++;
            Q.push(PAIR(R[A[i].num],A[i].num));
          }
    if(!flag) printf("No solution");
    else{
        printf("%d\n",ans);
        for(i=1;i<=n;i++)
            printf("%d\n",col[i]);
      }
    return 0;
}


#include<iostream>
#include<cstdio>
#include<cstring>
#include<cstdlib>
#include<cmath>
#include<algorithm>
#include<queue>
#define N 100005
#define PAIR pair<int,int>
#define LL long long
#define oo (1<<30)
using namespace std;
bool flag=0; int R[N];
priority_queue<PAIR> Q;
char st[N]; int ans=0,c[N];
int n,m,len=0,T,cnt,col[N];
struct ran{ int num,l,s;}A[N];
bool cmp(ran p,ran q){ return p.l<q.l||(p.l==q.l&&p.s<q.s);}
void read(int t)
{
    int h,m,s,ti;
    scanf("%s",st+1);
    h=(st[1]-'0')*10+st[2]-'0';
    m=(st[4]-'0')*10+st[5]-'0';
    s=(st[7]-'0')*10+st[8]-'0';
    ti=h*3600+m*60+s;
    A[++len]=(ran){t,ti,1};
    A[++len]=(ran){t,ti+T,-1};
    R[t]=ti+T;
}
int main()
{
    int i; PAIR x;
    scanf("%d %d %d\n",&n,&m,&T);
    for(i=1;i<=n;i++) read(i);
    sort(A+1,A+len+1,cmp);
    for(i=1;i<=len;i++)
        if(A[i].s<0){
            c[col[A[i].num]]--;
            if(!c[col[A[i].num]]) cnt--;
          }
        else{
            if((++cnt)>=m) flag=1;
            if(cnt<=m) col[A[i].num]=++ans;
            else{
                x=Q.top(),cnt--;
                col[A[i].num]=col[x.second];
              }
            c[col[A[i].num]]++;
            Q.push(PAIR(R[A[i].num],A[i].num));
          }
    if(!flag) printf("No solution");
    else{
        printf("%d\n",ans);
        for(i=1;i<=n;i++)
            printf("%d\n",col[i]);
      }
    return 0;
}


#include<iostream>
#include<cstdio>
#include<cstring>
#include<cstdlib>
#include<cmath>
#include<algorithm>
#include<queue>
#define N 100005
#define PAIR pair<int,int>
#define LL long long
#define oo (1<<30)
using namespace std;
bool flag=0; int R[N];
priority_queue<PAIR> Q;
char st[N]; int ans=0,c[N];
int n,m,len=0,T,cnt,col[N];
struct ran{ int num,l,s;}A[N];
bool cmp(ran p,ran q){ return p.l<q.l||(p.l==q.l&&p.s<q.s);}
void read(int t)
{
    int h,m,s,ti;
    scanf("%s",st+1);
    h=(st[1]-'0')*10+st[2]-'0';
    m=(st[4]-'0')*10+st[5]-'0';
    s=(st[7]-'0')*10+st[8]-'0';
    ti=h*3600+m*60+s;
    A[++len]=(ran){t,ti,1};
    A[++len]=(ran){t,ti+T+1,-1};
    R[t]=ti+T;
}
int main()
{
    int i; PAIR x;
    scanf("%d %d %d\n",&n,&m,&T);
    for(i=1;i<=n;i++) read(i);
    sort(A+1,A+len+1,cmp);
    for(i=1;i<=len;i++)
        if(A[i].s<0){
            c[col[A[i].num]]--;
            if(!c[col[A[i].num]]) cnt--;
          }
        else{
            if((++cnt)>=m) flag=1;
            if(cnt<=m) col[A[i].num]=++ans;
            else{
                x=Q.top(),cnt--;
                col[A[i].num]=col[-x.second];
              }
            c[col[A[i].num]]++;
            Q.push(PAIR(R[A[i].num],-A[i].num));
          }
    if(!flag) printf("No solution");
    else{
        printf("%d\n",ans);
        for(i=1;i<=n;i++)
            printf("%d\n",col[i]);
      }
    return 0;
}


#include<iostream>
#include<cstdio>
#include<cstring>
#include<cstdlib>
#include<cmath>
#include<algorithm>
#define N 100005
using namespace std;
int ans=0,flag=0;
char st[25]; int r[N];
int n,m,T,col[N],l[N];
void read(int t)
{
    int h,m,s;
    scanf("%s",st+1);
    h=(st[1]-'0')*10+st[2]-'0';
    m=(st[4]-'0')*10+st[5]-'0';
    s=(st[7]-'0')*10+st[8]-'0';
    l[t]=h*3600+m*60+s;
    r[t]=l[t]+T-1;
}
int main()
{
    int i,x;
    scanf("%d %d %d\n",&n,&m,&T);
    for(i=1;i<=n;i++) read(i);
    if(m==1) flag=1; r[0]=-1;
    for(i=1;i<=n;i++){
        if(r[i-1]<l[i]){ col[i]=++ans; continue;}
        x=lower_bound(r+1,r+n+1,l[i])-r;
        if(col[i-1]-col[x]+1==m) col[i]=col[i-1];
        else col[i]=++ans;
        if(col[i]-col[x]+1==m) flag=1;
      }
    if(!flag){
        printf("No solution");
        return 0;
    }
    printf("%d\n",ans);
    for(i=1;i<=n;i++)
        printf("%d\n",col[i]);
    return 0;
}


#include<iostream>
#include<cstdio>
#include<cstring>
#include<cstdlib>
#include<cmath>
#include<algorithm>
#define N 100005
using namespace std;
int ans=0,flag=0;
char st[25]; int r[N];
int n,m,T,col[N],l[N];
void read(int t)
{
    int h,m,s;
    scanf("%s",st+1);
    h=(st[1]-'0')*10+st[2]-'0';
    m=(st[4]-'0')*10+st[5]-'0';
    s=(st[7]-'0')*10+st[8]-'0';
    l[t]=h*3600+m*60+s,r[t]=l[t]+T;
}
int main()
{
    int i,x;
    scanf("%d %d %d\n",&n,&m,&T);
    for(i=1;i<=n;i++) read(i);
    if(m==1) flag=1;
    for(i=1;i<=n;i++){
        if(r[i-1]<l[i]){ col[i]=++ans; continue;}
        x=lower_bound(r+1,r+n+1,l[i])-r;
        if(col[i-1]-col[x]+1==m) col[i]=col[i-1];
        else col[i]=++ans;
        if(col[i]-col[x]+1==m) flag=1;
      }
    if(!flag){
        printf("No solution");
        return 0;
    }
    printf("%d\n",ans);
    for(i=1;i<=n;i++)
        printf("%d\n",col[i]);
    return 0;
}


#include<iostream>
#include<cstdio>
#include<cstring>
#include<cstdlib>
#include<cmath>
#include<algorithm>
#include<queue>
#define N 40005
#define PAIR pair<int,int>
#define LL long long
#define oo (1<<30)
using namespace std;
bool flag=0; int R[N];
priority_queue<PAIR> Q;
char st[N]; int ans=0,c[N];
int n,m,len=0,T,cnt,col[N];
struct ran{ int num,l,s;}A[N];
bool cmp(ran p,ran q){ return p.l<q.l||(p.l==q.l&&p.s<q.s);}
void read(int t)
{
    int h,m,s,ti;
    scanf("%s",st+1);
    h=(st[1]-'0')*10+st[2]-'0';
    m=(st[4]-'0')*10+st[5]-'0';
    s=(st[7]-'0')*10+st[8]-'0';
    ti=h*3600+m*60+s;
    A[++len]=(ran){t,ti,1};
    A[++len]=(ran){t,ti+T,-1};
    R[t]=ti+T-1;
}
int main()
{
    int i; PAIR x;
    scanf("%d %d %d\n",&n,&m,&T);
    for(i=1;i<=n;i++) read(i);
    sort(A+1,A+len+1,cmp);
    for(i=1;i<=len;i++)
        if(A[i].s<0){
            c[col[A[i].num]]--;
            if(!c[col[A[i].num]]) cnt--;
          }
        else{
            if((++cnt)>=m) flag=1;
            if(cnt<=m) col[A[i].num]=++ans;
            else{
                x=Q.top(),cnt--;
                col[A[i].num]=col[x.second];
              }
            c[col[A[i].num]]++;
            Q.push(PAIR(R[A[i].num],A[i].num));
          }
    if(!flag) printf("No solution");
    else{
        printf("%d\n",ans);
        for(i=1;i<=n;i++)
            printf("%d\n",col[i]);
      }
    return 0;
}


#include<iostream>
#include<cstdio>
#include<cstring>
#include<cstdlib>
#include<cmath>
#include<algorithm>
#include<queue>
#define N 100005
#define PAIR pair<int,int>
#define LL long long
#define oo (1<<30)
using namespace std;
bool flag=0; int R[N];
priority_queue<PAIR> Q;
char st[N]; int ans=0,c[N];
int n,m,len=0,T,cnt,col[N];
struct ran{ int num,l,s;}A[N];
bool cmp(ran p,ran q){ return p.l<q.l||(p.l==q.l&&p.s<q.s);}
void read(int t)
{
    int h,m,s,ti;
    scanf("%s",st+1);
    h=(st[1]-'0')*10+st[2]-'0';
    m=(st[4]-'0')*10+st[5]-'0';
    s=(st[7]-'0')*10+st[8]-'0';
    ti=h*3600+m*60+s;
    A[++len]=(ran){t,ti,1};
    A[++len]=(ran){t,ti+T+1,-1};
    R[t]=ti+T;
}
int main()
{
    int i; PAIR x;
    scanf("%d %d %d\n",&n,&m,&T);
    for(i=1;i<=n;i++) read(i);
    sort(A+1,A+len+1,cmp);
    for(i=1;i<=len;i++)
        if(A[i].s<0){
            c[col[A[i].num]]--;
            if(!c[col[A[i].num]]) cnt--;
          }
        else{
            if((++cnt)>=m) flag=1;
            if(cnt<=m) col[A[i].num]=++ans;
            else{
                x=Q.top(),cnt--;
                col[A[i].num]=col[x.second];
              }
            c[col[A[i].num]]++;
            Q.push(PAIR(R[A[i].num],A[i].num));
          }
    if(!flag) printf("No solution");
    else{
        printf("%d\n",ans);
        for(i=1;i<=n;i++)
            printf("%d\n",col[i]);
      }
    return 0;
}