# -*- coding: utf-8 -*-



import sys



def input(): return sys.stdin.readline().strip()

def list2d(a, b, c): return [[c] * b for i in range(a)]

def list3d(a, b, c, d): return [[[d] * c for j in range(b)] for i in range(a)]

def list4d(a, b, c, d, e): return [[[[e] * d for j in range(c)] for j in range(b)] for i in range(a)]

def ceil(x, y=1): return int(-(-x // y))

def INT(): return int(eval(input()))

def MAP(): return list(map(int, input().split()))

def LIST(N=None): return list(MAP()) if N is None else [INT() for i in range(N)]

def Yes(): print('Yes')

def No(): print('No')

def YES(): print('YES')

def NO(): print('NO')

sys.setrecursionlimit(10 ** 9)

INF = 10 ** 18

MOD = 10 ** 9 + 7



class BIT:

    """ Binary Indexed Tree """



    def __init__(self, n):

        # 0-indexed

        n += 1

        nv = 1

        while nv < n:

            nv *= 2

        self.size = nv

        self.tree = [0] * nv



    def sum(self, i):

        """ [0, i]を合計する """

        s = 0

        i += 1

        while i > 0:

            s += self.tree[i-1]

            i -= i & -i

        return s



    def add(self, i, x):

        """ 値の追加：添字i, 値x """

        i += 1

        while i <= self.size:

            self.tree[i-1] += x

            i += i & -i



    def get(self, l, r=None):

        """ 区間和の取得 [l, r) """

        # 引数が1つなら一点の値を取得

        if r is None: r = l + 1

        res = 0

        if r: res += self.sum(r-1)

        if l: res -= self.sum(l-1)

        return res



N = INT()

A = LIST()



bit = BIT(N)

ans = 0

for i in range(N):

    # 自分より左にある、自分より小さな数の個数

    if bit.sum(A[i]) == 0:

        ans += 1

    bit.add(A[i], 1)

print(ans)

# -*- coding: utf-8 -*-



import sys



def input(): return sys.stdin.readline().strip()

def list2d(a, b, c): return [[c] * b for i in range(a)]

def list3d(a, b, c, d): return [[[d] * c for j in range(b)] for i in range(a)]

def list4d(a, b, c, d, e): return [[[[e] * d for j in range(c)] for j in range(b)] for i in range(a)]

def ceil(x, y=1): return int(-(-x // y))

def INT(): return int(eval(input()))

def MAP(): return list(map(int, input().split()))

def LIST(N=None): return list(MAP()) if N is None else [INT() for i in range(N)]

def Yes(): print('Yes')

def No(): print('No')

def YES(): print('YES')

def NO(): print('NO')

sys.setrecursionlimit(10 ** 9)

INF = 10 ** 18

MOD = 10 ** 9 + 7



N = INT()

A = LIST()



ans = 0

mn = INF

for a in A:

    if a < mn:

        mn = a

        ans += 1

print(ans)

# -*- coding: utf-8 -*-
import sys


def input():
    return sys.stdin.readline().strip()


def list2d(a, b, c):
    return [[c] * b for i in range(a)]


def list3d(a, b, c, d):
    return [[[d] * c for j in range(b)] for i in range(a)]


def list4d(a, b, c, d, e):
    return [[[[e] * d for j in range(c)] for j in range(b)] for i in range(a)]


def ceil(x, y=1):
    return int(-(-x // y))


def INT():
    return int(eval(input()))


def MAP():
    return list(map(int, input().split()))


def LIST(N=None):
    return list(MAP()) if N is None else [INT() for i in range(N)]


def Yes():
    print("Yes")


def No():
    print("No")


def YES():
    print("YES")


def NO():
    print("NO")


sys.setrecursionlimit(10**9)
INF = 10**18
MOD = 10**9 + 7


class BIT:
    """Binary Indexed Tree"""

    def __init__(self, n):
        # 0-indexed
        n += 1
        nv = 1
        while nv < n:
            nv *= 2
        self.size = nv
        self.tree = [0] * nv

    def sum(self, i):
        """[0, i]を合計する"""
        s = 0
        i += 1
        while i > 0:
            s += self.tree[i - 1]
            i -= i & -i
        return s

    def add(self, i, x):
        """値の追加：添字i, 値x"""
        i += 1
        while i <= self.size:
            self.tree[i - 1] += x
            i += i & -i

    def get(self, l, r=None):
        """区間和の取得 [l, r)"""
        # 引数が1つなら一点の値を取得
        if r is None:
            r = l + 1
        res = 0
        if r:
            res += self.sum(r - 1)
        if l:
            res -= self.sum(l - 1)
        return res


N = INT()
A = LIST()
bit = BIT(N)
ans = 0
for i in range(N):
    # 自分より左にある、自分より小さな数の個数
    if bit.sum(A[i]) == 0:
        ans += 1
    bit.add(A[i], 1)
print(ans)

# -*- coding: utf-8 -*-
import sys


def input():
    return sys.stdin.readline().strip()


def list2d(a, b, c):
    return [[c] * b for i in range(a)]


def list3d(a, b, c, d):
    return [[[d] * c for j in range(b)] for i in range(a)]


def list4d(a, b, c, d, e):
    return [[[[e] * d for j in range(c)] for j in range(b)] for i in range(a)]


def ceil(x, y=1):
    return int(-(-x // y))


def INT():
    return int(eval(input()))


def MAP():
    return list(map(int, input().split()))


def LIST(N=None):
    return list(MAP()) if N is None else [INT() for i in range(N)]


def Yes():
    print("Yes")


def No():
    print("No")


def YES():
    print("YES")


def NO():
    print("NO")


sys.setrecursionlimit(10**9)
INF = 10**18
MOD = 10**9 + 7
N = INT()
A = LIST()
ans = 0
mn = INF
for a in A:
    if a < mn:
        mn = a
        ans += 1
print(ans)

- - -class BIT: -    """Binary Indexed Tree""" - -    def __init__(self, n): -        # 0-indexed -        n += 1 -        nv = 1 -        while nv < n: -            nv *= 2 -        self.size = nv -        self.tree = [0] * nv - -    def sum(self, i): -        """[0, i]を合計する""" -        s = 0 -        i += 1 -        while i > 0: -            s += self.tree[i - 1] -            i -= i & -i -        return s - -    def add(self, i, x): -        """値の追加：添字i, 値x""" -        i += 1 -        while i <= self.size: -            self.tree[i - 1] += x -            i += i & -i - -    def get(self, l, r=None): -        """区間和の取得 [l, r)""" -        # 引数が1つなら一点の値を取得 -        if r is None: -            r = l + 1 -        res = 0 -        if r: -            res += self.sum(r - 1) -        if l: -            res -= self.sum(l - 1) -        return res - - -bit = BIT(N) -for i in range(N): -    # 自分より左にある、自分より小さな数の個数 -    if bit.sum(A[i]) == 0: +mn = INF +for a in A: +    if a < mn: +        mn = a -    bit.add(A[i], 1)