Problem:


Score : 200 points

Problem Statement

We have N squares assigned the numbers 1,2,3,\ldots,N. Each square has an integer written on it, and the integer written on Square i is a_i.

How many squares i satisfy both of the following conditions?

The assigned number, i, is odd.

The written integer is odd.

Constraints

All values in input are integers.

1 \leq N, a_i \leq 100

Input

Input is given from Standard Input in the following format:

N
a_1 a_2 \cdots a_N

Output

Print the number of squares that satisfy both of the conditions.

Sample Input 1

5
1 3 4 5 7

Sample Output 1

2

Two squares, Square 1 and 5, satisfy both of the conditions.

For Square 2 and 4, the assigned numbers are not odd.

For Square 3, the written integer is not odd.

Sample Input 2

15
13 76 46 15 50 98 93 77 31 43 84 90 6 24 14

Sample Output 2

3



Sample input:
5
1 3 4 5 7


Sample output:
2

Submission status: Accepted

Solution code:
N = int(input())
A = [0] + list(map(int, input().split()))
cnt = 0
for i in range(1, N + 1):
    if i % 2 == 1 and A[i] % 2 == 1:
        cnt += 1
print(cnt)

Submission status: Accepted

Solution code:
n = int(input())
arr = list(map(int,input().split()))
ans = 0
for i in range(n):
    if i%2==0 and arr[i]%2!=0:
        ans+=1
print(ans)

Submission status: Accepted

Solution code:
# coding: utf-8

N=int(input())
#S=input()
#A,B = map(int, input().split())
#A,B = input().split()
#List = [int(input()) for i in range(5)]

List = list(map(int, input().split()))
ans=0
i=1
while i<=N:
    if i%2!=0 and List[i-1]%2!=0:
        ans+=1
    i+=1
print(ans)

Submission status: Accepted

Solution code:
n=int(input())
A=list(map(int,input().split()))
cnt=0
for i in range(n):
    if i%2==0 and A[i]%2==1:
        cnt+=1
print(cnt)

Submission status: Accepted

Solution code:
n = int(input())
a = list(map(int, input().split()))
ans = 0
for i in range(n):
    if i%2==0:
        if a[i]%2==1:
            ans += 1
print(ans)

Submission status: Accepted

Solution code:
N = int(input())
arr = list(map(int, input().split(" ")))
ans = 0
for i in range(0,N,2):
    if arr[i]%2: ans += 1
print(ans)

Submission status: Accepted

Solution code:
n=int(input())
l=list(map(int,input().split()))
c=0
for e,v in enumerate(l,start=1):
    if e%2==1 and v%2==1:
        c+=1
print(c)

Submission status: Accepted

Solution code:
import sys
from math import ceil, floor, sqrt, sin, cos, pi
from itertools import accumulate, permutations, combinations
from fractions import gcd # 最大公約数
from collections import deque, Counter
from operator import itemgetter
from heapq import heappop,heappush
sys.setrecursionlimit(10**7)
def lcm(x, y): return ((x * y) // gcd(x, y)) # 最小公倍数
# list(map(int, input().split()))

n = int(input())
a = list(map(int, input().split()))

ans = 0
for i in range(n):
    if i%2 == 0:
        if a[i]%2 == 1:
            ans += 1
print(ans)

Submission status: Accepted

Solution code:
N = int(input())
a = list(map(int,input().split()))
c = 0
for i in range(0,N,2):
  if a[i] % 2 == 1:
    c+= 1
print(c)

Submission status: Accepted

Solution code:
n = int(input())
a = [int(i) for i in input().split()]
cnt = 0
for i in range(n):
    if a[i]%2==1 and (i+1)%2==1:
        cnt +=1
print(cnt)

Submission status: Accepted

Solution code:
def getN():
    return int(input())
def getNM():
    return map(int, input().split())
def getList():
    return list(map(int, input().split()))
def getArray(intn):
    return [int(input()) for i in range(intn)]
def input():
    return sys.stdin.readline().rstrip()
def rand_N(ran1, ran2):
    return random.randint(ran1, ran2)
def rand_List(ran1, ran2, rantime):
    return [random.randint(ran1, ran2) for i in range(rantime)]
def rand_ints_nodup(ran1, ran2, rantime):
  ns = []
  while len(ns) < rantime:
    n = random.randint(ran1, ran2)
    if not n in ns:
      ns.append(n)
  return sorted(ns)

def rand_query(ran1, ran2, rantime):
  r_query = []
  while len(r_query) < rantime:
    n_q = rand_ints_nodup(ran1, ran2, 2)
    if not n_q in r_query:
      r_query.append(n_q)
  return sorted(r_query)

from collections import defaultdict, deque, Counter
from sys import exit
from decimal import *
import heapq
import math
from fractions import gcd
import random
import string
import copy
from itertools import combinations, permutations, product
from operator import mul
from functools import reduce
from bisect import bisect_left, bisect_right

import sys
sys.setrecursionlimit(1000000000)
mod = 10 ** 9 + 7

#############
# Main Code #
#############

N = getN()
A = getList()

cnt = 0
for i in range(N):
    if i % 2 == 0 and A[i] % 2 == 1:
        cnt += 1
print(cnt)

Submission status: Accepted

Solution code:
def resolve():
    n = int(input())
    A = list(map(int, input().split()))
    ans = 0
    for i in range(1, n + 1):
        if i % 2 != 0 and A[i - 1] % 2 != 0:
            ans += 1
    print(ans)

resolve()

Submission status: Accepted

Solution code:
N = int(input())
A = list(map(int, input().split())) 
ans = 0
for i in range(1,N+1):
    if i%2 and A[i-1]%2:
        ans += 1
print(ans)

Submission status: Accepted

Solution code:
N = int(input())
a = [int(x) for x in input().split()]

ans = 0
for i, x in enumerate(a):
    if i % 2 == 0:
        if x % 2 == 1:
            ans += 1
print(ans)

Submission status: Accepted

Solution code:
n = int(input())
l = list(map(int,input().split()))

c = 0
for i in range(0,n,2):
   if l[i] % 2 == 1:
       c += 1
print(c)

Submission status: Accepted

Solution code:
n = int(input())
a = list(map(int, input().split()))

ans = 0
for i in range(n):
    if i%2 == 1: continue
    if a[i]%2 == 1:
        ans += 1

print(ans)

Submission status: Accepted

Solution code:
n = int(input())
a = list(map(int,input().split()))
c = 0
for i in range(n):
	if i%2 == 0 and a[i]%2 != 0:
		c += 1
print(c)

Submission status: Accepted

Solution code:
N = int(input())
a = list(map(int,input().split()))
ans = 0
for i in range(N):
    if i%2 == 0:
        if a[i]%2 == 1:
            ans += 1
print(ans)

Submission status: Accepted

Solution code:
n = int(input())
list = [int(i) for i in input().split()]
ans = 0
for i in range(n):
    if i%2==0 and list[i]%2==1:
        ans += 1
print(ans)

Submission status: Accepted

Solution code:
n=int(input())
A=list(map(int,input().split()))
cnt=0
for i in range(len(A)):
    if (i+1)%2==1 and A[i]%2==1:
        cnt+=1
print(cnt)

Submission status: Accepted

Solution code:
N = int(input())
A = list(map(int,input().split()))
ans = 0
for i in range(N):
    if A[i]%2 == 1 and (i+1)%2 == 1:
        ans += 1
print(ans)

Submission status: Accepted

Solution code:
import sys
read = sys.stdin.read
readline = sys.stdin.readline
readlines = sys.stdin.readlines

def main():
    N = int(readline())
    A = [int(i) for i in readline().split()]

    ans = 0
    for i, a in enumerate(A):
        if ((i + 1) % 2 == 1) and (a % 2 == 1):
            ans += 1
    
    print(ans)


if __name__ == "__main__":
    main()

Submission status: Accepted

Solution code:
n = int(input())
xs = list(map(int,input().split()))
cnt = 0
for i, x in enumerate(xs, 1):
  if i % 2 != 0 and x % 2 != 0:
    cnt += 1
print(cnt)

Submission status: Accepted

Solution code:
import sys
sys.setrecursionlimit(1000000000)
import math
from math import gcd
def lcm(a, b): return a * b // gcd(a, b)
from itertools import count, permutations, chain, product
from functools import lru_cache
from collections import deque, defaultdict
from pprint import pprint
ii = lambda: int(input())
mis = lambda: map(int, input().split())
lmis = lambda: list(mis())
INF = float('inf')
N1097 = 10**9 + 7

def meg(f, ok, ng):
    while abs(ok-ng)>1:
        mid = (ok+ng)//2
        if f(mid):
            ok=mid
        else:
            ng=mid
    return ok

def get_inv(n, modp):
    return pow(n, modp-2, modp)

def factorials_list(n, modp):    # 10**6
    fs = [1]
    for i in range(1, n+1):
        fs.append(fs[-1] * i % modp)
    return fs

def invs_list(n, fs, modp):     # 10**6
    invs = [get_inv(fs[-1], modp)]
    for i in range(n, 1-1, -1):
        invs.append(invs[-1] * i % modp)
    invs.reverse()
    return invs

def comb(n, k, modp):
    num = 1
    for i in range(n, n-k, -1):
        num = num * i % modp
    den = 1
    for i in range(2, k+1):
        den = den * i % modp
    return num * get_inv(den, modp) % modp

def comb_from_list(n, k, modp, fs, invs):   
    return fs[n] * invs[n-k] * invs[k] % modp

#

class UnionFindEx:
    def __init__(self, size):
        #正なら根の番号、負ならグループサイズ
        self.roots = [-1] * size
    def getRootID(self, i):
        r = self.roots[i]
        if r < 0:   #負なら根
            return i
        else:
            r = self.getRootID(r)
            self.roots[i] = r
            return r
    def getGroupSize(self, i):
        return -self.roots[self.getRootID(i)]
    def connect(self, i, j):
        r1, r2 = self.getRootID(i), self.getRootID(j)
        if r1 == r2:
            return False
        if self.getGroupSize(r1) < self.getGroupSize(r2):
            r1, r2 = r2, r1
        self.roots[r1] += self.roots[r2]    #サイズ更新
        self.roots[r2] = r1
        return True

Yes = 'Yes'
No = 'No'


def main():
    N=ii()
    a=lmis()
    print(sum(a[i]&1 for i in range(0, N, 2)))






main()

Submission status: Accepted

Solution code:
n = int(input())
a=list(map(int,input().split()))
ans=0
for i in range(0,n,2):
    if a[i]&1:
        ans+=1
print(ans)

Submission status: Accepted

Solution code:
N = int(input())
a = [0] + list(map(int, input().split()))
cnt = 0
for i in range(1, N+1):
    ai = a[i]
    if i%2 == 1 and ai%2 == 1:
        cnt += 1
print(cnt)

Submission status: Accepted

Solution code:
import sys


def input(): return sys.stdin.readline().strip()
def I(): return int(input())
def LI(): return list(map(int, input().split()))
def IR(n): return [I() for i in range(n)]
def LIR(n): return [LI() for i in range(n)]
def SR(n): return [S() for i in range(n)]
def S(): return input()
def LS(): return input().split()


INF = float('inf')

n = I()
a = LI()
ans = 0
for i, elem in enumerate(a):
    if (i + 1) % 2 != 0 and elem % 2 != 0:
        ans += 1
print(ans)

Submission status: Accepted

Solution code:
N=int(input())
a=list(map(int,input().split()))
count=0
for i in range(N):
    if(i+1)%2==1 and a[i]%2==1:
        count+=1
print(count)

Submission status: Accepted

Solution code:
N = int(input())
L = list(map(int, input().split()))
ans = 0
for i, l in enumerate(L):
  if i % 2 != 1 and l % 2 == 1:
    ans += 1
print(ans)

Submission status: Accepted

Solution code:
from sys import stdin
N = int(stdin.readline().rstrip())
A = [int(x) for x in stdin.readline().rstrip().split()]
ans = 0
for i in A[0::2]:
    if i % 2 != 0:
        ans += 1
print(ans)

Submission status: Accepted

Solution code:
N = int(input())
a = list(map(int, input().split()))

cnt = 0

for i in range(N):
    if i % 2 == 0 and a[i] % 2 == 1:
        cnt += 1

print(cnt)

Submission status: Accepted

Solution code:
n=int(input())
l=list(map(int,input().split()))
cnt=0
for i in range(len(l)):
    if (i+1)%2==1 and l[i]%2==1:
        cnt+=1
print(cnt)

Submission status: Accepted

Solution code:
n=int(input())
a=list(map(int,input().split()))
ans=0
for i in range(0,n,2):
    if a[i]%2==1:
        ans += 1
print(ans)

Submission status: Accepted

Solution code:
N=int(input())
a=list(map(int,input().split()))

ans=0
for i in range(0,N,2):
    if a[i]%2==1:
        ans+=1
print(ans)

Submission status: Accepted

Solution code:
N = int(input())
a = list(map(int,input().split()))

ans = 0

for i in range(0,N,1):
    if (i+1)%2==1 and a[i]%2==1:
        ans+=1

print(ans)

Submission status: Accepted

Solution code:
n = int(input())
a = list(map(int, input().split()))
ans = 0

for i in range(0, n, 2):
    if a[i]%2 == 1:
        ans += 1

print(ans)

Submission status: Accepted

Solution code:
n = int(input())
l = list(map(int, input().split()))
ans = 0
l = l[0::2]

for i in l:
    if i % 2 == 1:
        ans += 1
print(ans)

Submission status: Accepted

Solution code:
def main():
    N = int(input())
    A = list(map(int, input().split()))

    ans = len([a for a in A[::2] if a % 2 == 1])
    print(ans)

if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
def main():
    n = int(input())
    a = list(map(int, input().split()))
    cnt = 0
    for i in range(0, n, 2):
        if i%2 == 0 and a[i]%2:
            cnt += 1
    print(cnt)
if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
# coding: utf-8
# Your code here!
import sys
read = sys.stdin.read
readline = sys.stdin.readline

#n,k,*a = map(int,read().split())
n,*a = map(int,read().split())
print([i%2 for i in a[::2]].count(1))

Submission status: Accepted

Solution code:
from sys import stdin
input = stdin.readline

N = int(input())
A = list(map(int, input().split()))

ans = 0

for i, a in enumerate(A):
    if (i + 1) % 2 == 1 and a % 2 == 1:
        ans += 1

print(ans)

Submission status: Accepted

Solution code:
#!/usr/bin/env python3

def compute(bs):
    return sum(i % 2 == b % 2 == 1 for i, b in enumerate(bs, start=1))


def main():
    _ = int(input())
    bs = [int(b) for b in input().split()]
    res = compute(bs)
    print(res)


if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
n=int(input())
a=list(map(int, input().split()))
ans=0
for i in range(n):
    if i%2==0 and a[i]%2==1:
        ans+=1
print(ans)

Submission status: Accepted

Solution code:
N = int(input())
ans = 0
A = list(map(int,input().rstrip().split(" ")))
for i in range(0,N,2):
    if A[i] % 2 == 1:
        ans += 1
print(ans)

Submission status: Accepted

Solution code:
n = int(input())
a = list(map(int, input().split()))

ans = 0
for i in range(n):
    if i % 2 == 0 and a[i] % 2 == 1:
        ans += 1

print(ans)

Submission status: Accepted

Solution code:
n = int(input())
A = list(map(int, input().split()))

ans = 0
for i, a in enumerate(A):
    masu_num = i + 1
    if masu_num % 2 == 1 and a % 2 == 1:
        ans += 1
print(ans)

Submission status: Accepted

Solution code:
N = int(input())
a = list(map(int,input().split()))

ans = 0
for i in range(0,N,2):
    if a[i] % 2 == 1:
        ans += 1

print(ans)

Submission status: Accepted

Solution code:
N = int(input())
a = list(map(int, input().split()))

result = 0
for i in range(N):
    if (i + 1) % 2 == 1 and a[i] % 2 == 1:
        result += 1
print(result)

Submission status: Accepted

Solution code:
N = int(input())
a = list(map(int, input().split()))

Sum = 0

for i in range(0,N,2):
    if a[i] % 2 == 1:
        Sum += 1

print(Sum)

Submission status: Accepted

Solution code:
N = int(input())
A = list(map(int, input().split()))
print(sum(a % 2 for a in A[::2]))

Submission status: Accepted

Solution code:
n = int(input())
A = list(int(x) for x in input().split())
ans = 0
for i, a in enumerate(A, start=1):
    if i % 2 == 1 and a % 2 == 1:
        ans += 1

print(ans)

Submission status: Accepted

Solution code:
N=int(input())
A=list(map(int,input().split()))
count = 0
for i in range(len(A)):
  if A[i]%2==1 and (i+1)%2==1:count+=1
print(count)

Submission status: Accepted

Solution code:
# from pprint import pprint
# import math
# import collections

n = int(input())
# n, k = map(int, input().split(' '))
a = list(map(int, input().split(' ')))

cnt = 0
for i in range(n):
    if (i + 1) % 2 == 1 and a[i] % 2 == 1:
        cnt += 1


print(cnt)

Submission status: Accepted

Solution code:
N=int(input())
a=list(map(int,input().split()))
cnt=0
for i in range(0,N,2):
    if a[i]%2!=0:
        cnt+=1
print(cnt)

Submission status: Accepted

Solution code:
ans=0
n=int(input())
a=list(map(int,input().split()))
for i in range(0,n,2):
    if a[i]%2==1:
        ans+=1
print(ans)

Submission status: Accepted

Solution code:
N=int(input())
a=input().split()
A=[int(b) for b in a]
answer=0
for n in range(N):
    if (n+1)%2==1 and A[n]%2==1:
        answer+=1
print(answer)

Submission status: Accepted

Solution code:
ans=0
n=int(input())
for i,v in enumerate(list(map(int,input().split()))):
    if i%2==0 and v%2:ans+=1
print(ans)

Submission status: Accepted

Solution code:
N = int(input())
A = list(int(a) for a in input().split())

ans = 0
for a, i in enumerate(A, 1):
    if i%2==1 and a%2==1:
        ans += 1

print(ans)

Submission status: Accepted

Solution code:
n = int(input())
arr = list(map(int, input().split()))

arr = arr[0::2]

print(len([x for x in arr if x % 2 == 1]))

Submission status: Accepted

Solution code:

N = int(input())
a = list(map(int,input().split()))

cnt=0
for i in range(N):
    if (i+1)%2==1 and a[i]%2==1:
        cnt+=1

print(cnt)

Submission status: Accepted

Solution code:
n = int(input())
a = [int(i) for i in input().split()]
ans = 0
for x,i in enumerate(a,1):
    if x%2 == 1 and i%2 == 1: ans += 1
print(ans)

Submission status: Accepted

Solution code:
import bisect,collections,copy,heapq,itertools,math,string
import sys
def S(): return sys.stdin.readline().rstrip()
def M(): return map(int,sys.stdin.readline().rstrip().split())
def I(): return int(sys.stdin.readline().rstrip())
def LI(): return list(map(int,sys.stdin.readline().rstrip().split()))
def LS(): return list(sys.stdin.readline().rstrip().split())
N = I()
A = LI()
ans = 0
for i in range(N):
    if i%2 ==0:
        if A[i] % 2==1:
            ans += 1
print(ans)

Submission status: Accepted

Solution code:
N=int(input())
a=list(map(int,input().split()))

ans=0
for i in range(N):
    if i%2==0 and a[i]%2==1:
        ans+=1

print(ans)

Submission status: Accepted

Solution code:
n=int(input())
a=list(map(int,input().split()))
c=0
for i in range(n):
  if i%2==0 and a[i]%2==1:
    c+=1
print(c)

Submission status: Accepted

Solution code:
def resolve():
    N = int(input())
    a = list(map(int, input().split()))
    ans = 0

    for i in range(N):
        if (i + 1) % 2 == 1 and a[i] % 2 == 1:
            ans += 1
    print(ans)

resolve()

Submission status: Accepted

Solution code:
def main():
    import sys
    N=int(sys.stdin.readline())
    A=list(map(int,sys.stdin.readline().split()))
    count=0
    for i,a in enumerate(A):
        if a%2 and (i+1)%2:
            count+=1
    print(count)
main()

Submission status: Accepted

Solution code:
n=int(input())
a=list(map(int,input().split()))
sum=0
for i in range(1,n+1):
    if (i%2==1)&(a[i-1]%2==1):
        sum+=1
print(sum)

Submission status: Accepted

Solution code:
n = int(input())
lis = list(map(int, input().split()))

ans = 0
for i in range(n):
    if i % 2 == 0 and lis[i] % 2 == 1:
        ans += 1

print(ans)

Submission status: Accepted

Solution code:
#5
#1 3 4 5 7
n = int(raw_input())
ais = map(int, raw_input().split())
c = 0
for i,ai in enumerate(ais):
	if (i+1) % 2 and ai % 2:
		c+=1 
print c

Submission status: Accepted

Solution code:
n = int(input())
A = tuple(map(int, input().split()))
ans = 0
for i, a in enumerate(A):
    if (i+1)%2 == 1 and a%2==1:
        ans += 1
print(ans)

Submission status: Accepted

Solution code:
n = int(input())
lis = list(map(int, input().split()))
ans=0
for i, li in enumerate(lis):
    if (i+1)%2==1 and li%2==1:
        ans+=1
print(ans)

Submission status: Accepted

Solution code:
n = int(input())
a = list(map(int, input().split()))
count = 0
for i in range(n):
    if i % 2 == 0 and a[i] % 2 == 1:
        count += 1 
print(count)

Submission status: Accepted

Solution code:
N = map(int, input().split())
a = list(map(int, input().split()))

c = 0
for i, d in enumerate(a):
  if i % 2 == 0 and d % 2 == 1:
    c += 1

print(c)

Submission status: Accepted

Solution code:
n = int(input())
dat = list(map(int, input().split()))
res = 0
for i in range(n):
    x = i + 1
    if dat[i] &1 == 1 and x&1 == 1:
        res += 1
print(res)

Submission status: Accepted

Solution code:
N=int(input())
A=list(map(int,input().split()))
ans=0
for i in range(0,N,2):
    if A[i]%2==1:
        ans+=1
print(ans)

Submission status: Accepted

Solution code:
import sys
# import re
import math
import collections
# import decimal
import bisect
import itertools
import fractions
# import functools
import copy
# import heapq
import decimal
# import statistics
import queue

# import numpy as np

sys.setrecursionlimit(10000001)
INF = 10 ** 16
MOD = 10 ** 9 + 7
# MOD = 998244353

ni = lambda: int(sys.stdin.readline())
ns = lambda: map(int, sys.stdin.readline().split())
na = lambda: list(map(int, sys.stdin.readline().split()))


# ===CODE===


def main():
    n = ni()
    a = na()

    ans = 0
    for i, ai in enumerate(a):
        if (i+1) % 2 and ai % 2:
            ans += 1
    print(ans)

if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
N = int(input())
#S = str(input())
#L, R, d = map(int, input().split())
A = list(map(int, input().split()))
ans = 0
for i in range(N):
  if i % 2 == 0:
    if A[i] % 2 == 1:
      ans += 1
      
print(ans)

Submission status: Accepted

Solution code:
n = int(input())
a = list(map(int, input(). split()))

cn = 0
for i in range(len(a)):
  ai = a[i]
  nm = i + 1
  if nm % 2 == 1 and ai % 2 == 1:
    cn += 1
print(cn)

Submission status: Accepted

Solution code:
n = int(input())
l = list(map(int, input().split()))
ans = 0

for i in range(0, n, 2):
  if l[i]%2==1:
    ans+= 1
    
print(ans)

Submission status: Accepted

Solution code:
n = int(input())
a_li = list(map(int,input().split()))
cnt = 0
for i in range(n):
    if i % 2 == 0:
        if a_li[i] % 2 == 1:
            cnt += 1
print(cnt)

Submission status: Accepted

Solution code:
N = int(input())
a = list(map(int, input().split()))
ans = 0
for k in range(0, N, 2):
  if a[k] % 2 == 1:
    ans += 1

print(ans)

Submission status: Accepted

Solution code:
n = int(input())
a = list(map(int, input().split()))

ans = 0
for i in range(n):
  if i%2 == 0 and a[i] %2 == 1:
    ans += 1
print (ans)

Submission status: Accepted

Solution code:
n=int(input())
a=list(map(int,input().split()))
cnt=0
for i in range(n):
    if i%2==0:
        if a[i]%2!=0:
            cnt+=1
print(cnt)

Submission status: Accepted

Solution code:
n=int(input())
a=list(map(int,input().split()))
ans=0
for i in range(n):
  if (i+1)*a[i] % 2:
    ans+=1
print(ans)

Submission status: Accepted

Solution code:
N=int(input())
a=list(map(int, input().split()))
ans=0
for i in range(N):
  if i%2==0 and a[i]%2==1:
    ans+=1
    
print(ans)

Submission status: Accepted

Solution code:
import math
import itertools
import collections
import bisect
import heapq

def IN(): return int(input())
def sIN(): return input()
def MAP(): return map(int,input().split())
def LMAP(): return list(map(int,input().split()))
def TATE(n): return [input() for i in range(n)]
MOD = 10**9 + 7

n = IN()
a = LMAP()
c = 0
ans = 0

for i in a:
  c += 1
  if i%2 == 1 and c%2 ==1:
    ans += 1
    
print(ans)

Submission status: Accepted

Solution code:
## coding: UTF-8
N = int(input())
A = list(map(int,input().split()))

ans = 0
for i in range(N):
    if(((i+1)*A[i]) % 2 == 1):
        ans += 1

print(ans)

Submission status: Accepted

Solution code:
n = int(input())
a = list(map(int,input().split()))
cnt = 0
for i in range(n):
    if (i+1) % 2 != 0 and a[i] % 2 != 0:
        cnt += 1
print(cnt)

Submission status: Accepted

Solution code:
# coding: utf-8
#import numpy as np
import re
import math
from collections import defaultdict,deque,Counter
from fractions import Fraction
import bisect
import itertools
from itertools import accumulate
from copy import deepcopy
import heapq
import random
import time
import os
import sys
from functools import lru_cache,reduce
readline=sys.stdin.readline
sys.setrecursionlimit(100000)
alp="abcdefghijklmnopqrstuvwxyz"
numbers="0123456789"
mod=int(10**9+7)
inf=int(10**19)
class Set():
    def __init__(self,A=[]):
        self.heap=[]
        self.dic=defaultdict(bool)
        self.size=0
        for a in A:self.add(a)
    
    def __str__(self):
        return str(self.heap)
    
    def add(self,x):
        if not self.find(x):
            heapq.heappush(self.heap,x)
            self.dic[x]=True
            self.size+=1

    def remove(self,x):
        if self.find(x):
            self.dic[x]=False
            self.size-=1

    def find(self,x):
        return self.dic[x]
    
    def top(self):
        while self.heap and self.dic[self.heap[0]]==False:
            heapq.heappop(self.heap)
        if self.heap:return self.heap[0]
        else:return None

    def pop(self):
        ret=None
        if self.heap:
            ret=self.top()
            self.remove(ret)
        return ret
class multiset():
    def __init__(self,A=[]):
        self.heap=[]
        self.dic=defaultdict(int)
        self.size=0
        for a in A:self.add(a)
    
    def __str__(self):
        return str(self.heap)
    
    def add(self,x):
        heapq.heappush(self.heap,x)
        self.dic[x]+=1
        self.size+=1

    def remove(self,x):
        if self.dic[x]>0:
            self.dic[x]-=1
            self.size-=1
    
    def count(self,x):
        return self.dic[x]

    def find(self,x):
        return self.dic[x]>0
    
    def top(self):
        while self.heap and self.dic[self.heap[0]]==0:
            heapq.heappop(self.heap)
        if self.heap:return self.heap[0]
        else:return None

    def pop(self):
        ret=None
        if self.heap:
            ret=self.top()
            self.remove(ret)
        return ret
class Edge():
    def __init__(self,x,y,val=1):
        self.x=x
        self.y=y
        self.val=val
class unionfind():
    def __init__(self,n):
        self.n=n
        self.P=[a for a in range(n)]
        self.rank=[0]*n
 
    def find(self,x):
        if(x!=self.P[x]):
            self.P[x]=self.find(self.P[x])
        return self.P[x]
 
    def same(self,x,y):
        return self.find(x)==self.find(y)
 
    def link(self,x,y):
        if self.rank[x]<self.rank[y]:
            self.P[x]=y
        elif self.rank[y]<self.rank[x]:
            self.P[y]=x
        else:
            self.P[x]=y
            self.rank[y]+=1
 
    def unite(self,x,y):
        self.link(self.find(x),self.find(y))
 
    def size(self):
        S=set()
        for a in range(self.n):
            S.add(self.find(a))
        return len(S)
def yn(b):print("yes" if b else "no")
def Yn(b):print("Yes" if b else "No")
def YN(b):print("YES" if b else "NO")
def ispow(a,b):
    now=b
    while now<a:
        now*=b
    return now==a
def getbin(num,size):
    A=[0]*size
    for a in range(size):
        if (num>>(size-a-1))&1==1:
            A[a]=1
        else:
            A[a]=0
    return A
def getfacs(n,mod_=0):
    A=[1]*(n+1)
    for a in range(2,len(A)):
        A[a]=A[a-1]*a
        if(mod_>0):A[a]%=mod_
    return A
def comb(n,r,mod,fac):
    if(n-r<0):return 0
    return (fac[n]*pow(fac[n-r],mod-2,mod)*pow(fac[r],mod-2,mod))%mod
def nextcomb(num,size):
    x=num&(-num)
    y=num+x
    z=num&(~y)
    z//=x
    z=z>>1
    num=(y|z)
    if(num>=(1<<size)):return False
    else:return num
def getprimes(n):
    if n==0:return []
    A=[True]*(n+1)
    A[0]=False
    A[1]=False
    for a in range(2,n+1):
        if A[a]:
            for b in range(a*2,n+1,a):
                A[b]=False
    ret=[]
    for a in range(n+1):
        if(A[a]):ret.append(a)
    return ret
def isprime(num):
    if(num<=1):return False
    i=2
    while i*i<=num:
       if(num%i==0):return False
       i+=1
    return True
def ifelse(b,t,f):return t if b else f
def factorize(n):
    b = 2
    ret=defaultdict(int)
    while b * b <= n:
        while n % b == 0:
            n //= b
            ret[b]+=1
        b+=1
    if n > 1:ret[n]+=1
    return ret
def inputintlist(row=1): 
    if row==1:
        ret=list(map(int,input().split()))
    else:
        ret=[None]*row
        for a in range(row):
            ret[a]=int(input())
    return ret
def inputfloatlist(row=1): 
    if row==1:
        ret=list(map(float,input().split()))
    else:
        ret=[None]*row
        for a in range(row):
            ret[a]=float(input())
    return ret
def istanchouzouka(A):
    f=True
    prev=min(A)-1
    for a in A:
        if prev>=a:
            f=False
        prev=a
    return f
def istanchouhigensyou(A):
    f=True
    prev=min(A)-1
    for a in A:
        if prev>a:
            f=False
        prev=a
    return f
def getallsum(A):
    s=sum(A)
    dp=defaultdict(int)
    dp[0]=1
    for a in range(0,len(A)):
        for b in range(s,-1,-1):
            if b-A[a]>=0:
                dp[b]+=dp[b-A[a]]
    return dp
def yuukoutomukou(edges):
    ret=deepcopy(edges)
    for edge in edges:
        if not edge.x==edge.y:
            ret.append(Edge(edge.y,edge.x,edge.val))
    return ret
def dijkstra(edges,V,start):
    mincost=[inf]*V
    G=[[] for a in range(V)]
    for edge in edges:
        G[edge.x].append([edge.val,edge.y])
    Q=PriorityQueue()
    Q.put([0,start])#[cost,x]
    while not Q.empty():
        nowcost,nowx=Q.get()
        if mincost[nowx]==inf:
            mincost[nowx]=nowcost
            for cost,y in G[nowx]:
                newcost=nowcost+cost
                Q.put([newcost,y])
    return mincost
def warshallfloyd(edges,V):
    mincost=[[inf for b in range(V)] for a in range(V)]
    for a in range(V):mincost[a][a]=0
    for edge in edges:
        mincost[edge.x][edge.y]=min(mincost[edge.x][edge.y],edge.val)#x→yが複数ある場合のためにmin()する
    for k in range(V):
        for s in range(V):
            for t in range(V):
                if mincost[s][k]==inf or mincost[k][t]==inf:continue
                mincost[s][t]=min(mincost[s][t],mincost[s][k]+mincost[k][t])
    return mincost
def bellemanford(edges,V,start):
    mincost=[inf]*V
    mincost[start]=0
    for _ in range(V):
        for edge in edges:
            if mincost[edge.x]==inf:continue
            mincost[edge.y]=min(mincost[edge.y],mincost[edge.x]+edge.val)
    return mincost
def getmd(x1,y1,x2,y2):return abs(x1-x2)+abs(y1-y2)
def geted(x1,y1,x2,y2):return math.sqrt((x1-x2)**2+(y1-y2)**2)
class fordfulkerson():
    def __init__(self,edges,V,s,t):
        self.V=V
        self.used=[False]*V
        self.G=[[] for a in range(V)]
        self.s=s
        self.t=t
        for edge in edges:
            self.G[edge.x].append({"x":edge.x,"y":edge.y,"cap":edge.val,"rev":len(self.G[edge.y])})
            self.G[edge.y].append({"x":edge.y,"y":edge.x,"cap":0,"rev":len(self.G[edge.x])-1})
    def dfs(self,v,t,f=inf):
        if v==t:return f
        self.used[v]=True
        for a in range(len(self.G[v])):
            x=self.G[v][a]["x"]
            y=self.G[v][a]["y"]
            cap=self.G[v][a]["cap"]
            rev=self.G[y][self.G[x][a]["rev"]]
            if self.used[y] or cap==0:continue
            f2=self.dfs(y,t,min(f,cap))
            if f2>0:
                self.G[v][a]["cap"]-=f2
                rev["cap"]+=f2
                return f2
        return 0
    def maxflow(self):
        flow=0
        while True:
            self.used=[False]*V
            zouka=self.dfs(self.s,self.t)
            if zouka==0:break
            flow+=zouka
        return flow
def zipsort(*args):
    ziplist=sorted(zip(*args))
    for a in range(len(args)):
        for b in range(len(ziplist)):
            args[a][b]=ziplist[b][a]
def zipreverse(*args):
    ziplist=list(zip(*args))
    rev=[]
    for a in range(len(ziplist)-1,-1,-1):
        rev.append(ziplist[a])
    for a in range(len(args)):
        for b in range(len(rev)):
            args[a][b]=rev[b][a]

######################################################################################################


N=int(input())
A=inputintlist()
ans=0
for a in range(N):
    i=a+1
    if i%2==1 and A[a]%2==1:
        ans+=1
print(ans)

Submission status: Accepted

Solution code:
N = int(input())
A = [int(i) for i in input().split()]

c = 0
for i in range(N):
    if A[i]%2==1 and i%2==0:
        c+=1

print(c)