#define NULL ((void *)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t;
typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1

/* Forward declarations */

/* Type definitions */

/* Variables and functions */
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ scanf(char *, ...);
int main() {
  int d[128] = {0}, n, c = 0;
  char s;
  scanf("%d\n", &n);
  if (n > 26) {
    printf("-1");
  } else {
    while (n--) {
      scanf("%c", &s);
      if (d[s])
        ++c;
      else
        d[s] = 1;
    }
    printf("%d", c);
  }
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x220,%rsp
movl   $0x0,-0x4(%rbp)
lea    -0x210(%rbp),%rdi
xor    %esi,%esi
mov    $0x200,%edx
call   1040 <memset@plt>
movl   $0x0,-0x218(%rbp)
lea    0xe9a(%rip),%rdi
lea    -0x214(%rbp),%rsi
mov    $0x0,%al
call   1050 <scanf@plt>
cmpl   $0x1a,-0x214(%rbp)
jle    1194 <main+0x64>
lea    0xe7c(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    121e <main+0xee>
jmp    1199 <main+0x69>
mov    -0x214(%rbp),%eax
mov    %eax,%ecx
add    $0xffffffff,%ecx
mov    %ecx,-0x214(%rbp)
cmp    $0x0,%eax
je     120a <main+0xda>
lea    0xe4d(%rip),%rdi
lea    -0x219(%rbp),%rsi
mov    $0x0,%al
call   1050 <scanf@plt>
movsbq -0x219(%rbp),%rax
ff
cmpl   $0x0,-0x210(%rbp,%rax,4)
je     11f2 <main+0xc2>
mov    -0x218(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x218(%rbp)
jmp    1205 <main+0xd5>
movsbq -0x219(%rbp),%rax
ff
movl   $0x1,-0x210(%rbp,%rax,4)
jmp    1199 <main+0x69>
mov    -0x218(%rbp),%esi
lea    0xdf3(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x4(%rbp),%eax
add    $0x220,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %rbx
sub    $0x210,%rsp
lea    0x10(%rsp),%rdi
xor    %ebx,%ebx
mov    $0x200,%edx
xor    %esi,%esi
call   1040 <memset@plt>
lea    0xeaa(%rip),%rdi
lea    0xc(%rsp),%rsi
xor    %eax,%eax
call   1050 <scanf@plt>
mov    0xc(%rsp),%eax
cmp    $0x1a,%eax
jle    117b <main+0x4b>
lea    0xe92(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
jmp    11e3 <main+0xb3>
sub    $0x1,%eax
mov    %eax,0xc(%rsp)
jb     11d3 <main+0xa3>
lea    0xe7c(%rip),%r14
lea    0xb(%rsp),%r15
xor    %ebx,%ebx
jmp    11af <main+0x7f>
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
movl   $0x1,0x10(%rsp,%rax,4)
subl   $0x1,0xc(%rsp)
jb     11d3 <main+0xa3>
mov    %r14,%rdi
mov    %r15,%rsi
xor    %eax,%eax
call   1050 <scanf@plt>
movsbq 0xb(%rsp),%rax
cmpl   $0x0,0x10(%rsp,%rax,4)
je     11a0 <main+0x70>
add    $0x1,%ebx
subl   $0x1,0xc(%rsp)
jae    11af <main+0x7f>
lea    0xe30(%rip),%rdi
mov    %ebx,%esi
xor    %eax,%eax
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x210,%rsp
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [4 x i8] c"%d\0A\00"
@.str.1 = [3 x i8] c"-1\00"
@.str.2 = [3 x i8] c"%c\00"
@.str.3 = [3 x i8] c"%d\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [128 x i32]
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8
store i32 0, i32* %1
%6 = bitcast [128 x i32]* %2 to i8*
store i32 0, i32* %4
%7 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32* %3)
%8 = load i32, i32* %3
%9 = icmp sgt i32 %8, 26
br i1 %9, label %10, label %12
10: ; preds = %0
%11 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
br label %35
12: ; preds = %0
br label %13
13: ; preds = %31, %12
%14 = load i32, i32* %3
%15 = add nsw i32 %14, -1
store i32 %15, i32* %3
%16 = icmp ne i32 %14, 0
br i1 %16, label %17, label %32
17: ; preds = %13
%18 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i8* %5)
%19 = load i8, i8* %5
%20 = sext i8 %19 to i64
%21 = getelementptr inbounds [128 x i32], [128 x i32]* %2, i64 0, i64 %20
%22 = load i32, i32* %21
%23 = icmp ne i32 %22, 0
br i1 %23, label %24, label %27
24: ; preds = %17
%25 = load i32, i32* %4
%26 = add nsw i32 %25, 1
store i32 %26, i32* %4
br label %31
27: ; preds = %17
%28 = load i8, i8* %5
%29 = sext i8 %28 to i64
%30 = getelementptr inbounds [128 x i32], [128 x i32]* %2, i64 0, i64 %29
store i32 1, i32* %30
br label %31
31: ; preds = %27, %24
br label %13
32: ; preds = %13
%33 = load i32, i32* %4
%34 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0), i32 %33)
br label %35
35: ; preds = %32, %10
%36 = load i32, i32* %1
ret i32 %36
}

LLVM IR (-O2):
@.str = [4 x i8] c"%d\0A\00"
@.str.1 = [3 x i8] c"-1\00"
@.str.2 = [3 x i8] c"%c\00"
@.str.3 = [3 x i8] c"%d\00"
define i32 @main() {
%1 = alloca [128 x i32]
%2 = alloca i32
%3 = alloca i8
%4 = bitcast [128 x i32]* %1 to i8*
%5 = bitcast i32* %2 to i8*
%6 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32* %2)
%7 = load i32, i32* %2
%8 = icmp sgt i32 %7, 26
br i1 %8, label %12, label %9
9: ; preds = %0
%10 = add nsw i32 %7, -1
store i32 %10, i32* %2
%11 = icmp eq i32 %7, 0
br i1 %11, label %30, label %14
12: ; preds = %0
%13 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
br label %33
14: ; preds = %9, %25
%15 = phi i32 [ %26, %25 ], [ 0, %9 ]
%16 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i8* %3)
%17 = load i8, i8* %3
%18 = sext i8 %17 to i64
%19 = getelementptr inbounds [128 x i32], [128 x i32]* %1, i64 0, i64 %18
%20 = load i32, i32* %19
%21 = icmp eq i32 %20, 0
br i1 %21, label %24, label %22
22: ; preds = %14
%23 = add nsw i32 %15, 1
br label %25
24: ; preds = %14
store i32 1, i32* %19
br label %25
25: ; preds = %24, %22
%26 = phi i32 [ %23, %22 ], [ %15, %24 ]
%27 = load i32, i32* %2
%28 = add nsw i32 %27, -1
store i32 %28, i32* %2
%29 = icmp eq i32 %27, 0
br i1 %29, label %30, label %14
30: ; preds = %25, %9
%31 = phi i32 [ 0, %9 ], [ %26, %25 ]
%32 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0), i32 %31)
br label %33
33: ; preds = %30, %12
ret i32 0
}